Class: Spud::UserSessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Spud::UserSessionsController
- Defined in:
- app/controllers/spud/user_sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/spud/user_sessions_controller.rb', line 13 def create @user_session = SpudUserSession.new(params[:spud_user_session]) if @user_session.save flash[:notice] = "Login successful!" redirect_back_or_default root_url else render :action => :new end end |
#destroy ⇒ Object
23 24 25 26 27 |
# File 'app/controllers/spud/user_sessions_controller.rb', line 23 def destroy current_user_session.destroy flash[:notice] = "Logout successful!" redirect_back_or_default new_spud_user_session_url end |
#new ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/controllers/spud/user_sessions_controller.rb', line 5 def new if SpudUser.count == 0 redirect_to spud_setup_url() and return end @user_session = SpudUserSession.new end |