I have a question :
I have Users that have a boolean attribute Admin.
What I did is basically : if admin attribute is set on false, then a
writing appears telling that 'you must be an admin to see this zone'.
I wanted to organize things differently, for example:
if the logged user is logged, and
if you are building athentication from scratch this method can be accessed
by the controller and views by putting that method in the
application_controller and adding
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
helper_method :current_user
this
2 matches
Mail list logo