Ruby on Rails
Friday, May 2, 2014
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?.
Thanks & Best regards.
Alfredo.
-- 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?.
Thanks & Best regards.
Alfredo.
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c47c469b-bfcb-45d8-a488-89074a16e648%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment