On Dec 14, 2009, at 5:32 PM, Brett Nelson wrote:

> Much better thanks Bryan!
>
> I put this in application_controller.rb and it works for when guest
> tries any other page.
>
>  before_filter :loggedin, :except => [:login]
>
>  def loggedin
>    redirect_to :login if current_user.guest?
>  end
>
> Initially left out the :except => [:login] and got a never ending
> loop :)
>

You'll likely prefer the existing :login_required helper, as it does a  
couple extra things:

- logs users in via HTTP-Auth, if that's available and set up (helps  
XML and API-style requests work)

- calls store_location so that user who aren't logged in who try to go  
to a page get sent there after logging in. Handy if you ever mail  
users links.

Hope this helps!

--Matt Jones

--

You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.


Reply via email to