rails 3.1 authentication

18 views
Skip to first unread message

Me

unread,
Sep 19, 2011, 8:27:12 PM9/19/11
to rubyonra...@googlegroups.com
I have the rails 3.1 authentication set up, how do I get it to make sure I authenticate system wide?

Leonardo Mateo

unread,
Sep 20, 2011, 5:39:26 AM9/20/11
to rubyonra...@googlegroups.com
On Mon, Sep 19, 2011 at 9:27 PM, Me <chab...@gmail.com> wrote:
> I have the rails 3.1 authentication set up, how do I get it to make sure I
> authenticate system wide?
If by system wide you mean every action on every controller you can
set up a before_filter on ApplicationController and check for the
current_user there.

Hope it helps.

Cheers.

--
Leonardo Mateo.
There's no place like ~

Kazimierz Kiełkowicz

unread,
Sep 20, 2011, 4:31:43 AM9/20/11
to Ruby on Rails: Talk
Use before_filter in ApplicationController class?

Robb

unread,
Sep 20, 2011, 2:34:04 AM9/20/11
to Ruby on Rails: Talk
If you want everything controller to use Authentication then I would
suggest using a before_filter in the ApplicationController. Something
like this

class ApplicationController < ActionController::Base
before_filter: some_authentication_method
end

Regards
Robb

spinlock

unread,
Sep 20, 2011, 2:01:18 PM9/20/11
to Ruby on Rails: Talk
I am currently using the devise gem for authentication. It provides a
great base for authentication so that you don't have to reinvent the
wheel.
Reply all
Reply to author
Forward
0 new messages