Ruby on Rails Saturday, May 3, 2014

Ok! And how can I test the production enviroment?.

Alfredo.

El viernes, 2 de mayo de 2014 12:19:02 UTC+2, Alfredo Barrero escribió:
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
  en
d

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/b20d9a74-27dc-4176-b1da-436c445e09bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment