Class: UserSessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UserSessionsController
- Defined in:
- app/controllers/user_sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/user_sessions_controller.rb', line 20 def create @user_session = UserSession.new(params[:user_session]) if @user_session.save flash[:notice] = "Login successful!" redirect_back_or_default user_url(@user_session.user) else render :action => :new end end |
#destroy ⇒ Object
30 31 32 33 34 |
# File 'app/controllers/user_sessions_controller.rb', line 30 def destroy current_user_session.destroy flash[:notice] = "Logout successful!" redirect_back_or_default '/' end |
#new ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/user_sessions_controller.rb', line 7 def new respond_to do |format| if current_user redirect_to :controll => 'users', :action => 'show', :id => current_user else @user_session = UserSession.new format.html # new.html.erb format.xml { render :xml => @user_session } end end end |