Module: Incline::Extensions::Session::Controller
- Defined in:
- lib/incline/extensions/session.rb
Overview
Contains the methods specific to controllers.
Instance Method Summary collapse
-
#forget(user) ⇒ Object
Removes the user from the permanent cookie store.
-
#log_in(user) ⇒ Object
Logs in the given user.
-
#log_out ⇒ Object
Logs out any currently logged in user.
-
#remember(user) ⇒ Object
Stores the user ID to the permanent cookie store to keep the user logged in.
Instance Method Details
#forget(user) ⇒ Object
Removes the user from the permanent cookie store.
97 98 99 100 101 |
# File 'lib/incline/extensions/session.rb', line 97 def forget(user) user.forget .delete() .delete() end |
#log_in(user) ⇒ Object
Logs in the given user.
75 76 77 |
# File 'lib/incline/extensions/session.rb', line 75 def log_in(user) session[:user_id] = user.id end |
#log_out ⇒ Object
Logs out any currently logged in user.
81 82 83 84 85 |
# File 'lib/incline/extensions/session.rb', line 81 def log_out forget current_user session.delete(:user_id) @current_user = nil end |
#remember(user) ⇒ Object
Stores the user ID to the permanent cookie store to keep the user logged in.
89 90 91 92 93 |
# File 'lib/incline/extensions/session.rb', line 89 def remember(user) user.remember .permanent.signed[] = user.id .permanent[] = user.remember_token end |