On Fri, May 2, 2014 at 5:19 AM, Alfredo Barrero <[email protected]> wrote:
> Good afternoon all,
>
> I'm trying to restrict the access to the application to paths like
> "localhost:3000/users/1" without a previus login. To do that I have create
> this function:
>
> 'session_controller.rb'
>   before_action :authorize
>
>   def authorize
>     if current_user.nil?
>       redirect_to home_path
>     else
>       redirect_to user_path(current_user.id)
>     end
>   end
>
> When the 'current_user' is nil it entryes to an infinite loop. What I have
> to do to solve this?.

Without actually seeing the code for what is answering home_path, I'm
going to make a guess that that controller+action is making a call to
the session controller.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAHUC_t8pbRJLKmhKu5wNc0tywx95DUk3r5NOKHZb0w6miN85Pg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to