Class: UserSessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- UserSessionsController
- Defined in:
- lib/app/controllers/user_sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/app/controllers/user_sessions_controller.rb', line 4 def create @user_session = UserSession.new params[:user_session] @user_session.save do |result| if result flash[:success] = "Welcome back" redirect_to root_url else render :action => :new end end end |
#destroy ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/app/controllers/user_sessions_controller.rb', line 22 def destroy if login login.destroy flash[:success] = "You are now logged out." else flash[:warning] = "You are already logged out." end redirect_to root_url end |
#new ⇒ Object
18 19 20 |
# File 'lib/app/controllers/user_sessions_controller.rb', line 18 def new @user_session = UserSession.new end |