Saturday 15 February 2014

preserve object ruby on rails -


I have an object on the rail for users with names, passwords, etc.

How to Can I make sure that values ​​are kept in all ideas?

Thanks

If you set it up:

< Pre> class ApplicationController & lt; ActionController :: Base before_filter: set_user protected def set_user @user = User.find_by_id (session [: user_id]) End End

Then in all controllers, because they all come from In the ApplicationController , the value will be set to user .

Note: If the session has not been scheduled for this session as [: User_id].

On filter and more: before_filter, check out this link:


No comments:

Post a Comment