ruby on rails - How to restrict user access page in RoR? -


I know that after the user login I can have a session and at the same time, I have an assistant method called "Current_User" I have not created any other people who can not get signed access to the page. How can I do this by doing this?

I can do that people are not allowed to gain access to the content, but I do not want to see the user blank pages within the login itself.

  & lt;% if current_user% & gt; My content & lt;% end% & gt;  

Make the first_filter, which checks that the current_user variable is set, and redirects the user Does some other place (root, signup page, something) if it is not. Something like this:

  class ApplicationController & lt; ActionController :: Base DF login_require redirect_to ('/') if current_user.blank? End and class microcontroller & lt; ApplicationController before_filter: login_required ,: only = & gt; : Action_aviable_only_for_logged_in def action_aviable_only_for_logged_in ... and end  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -