Created
July 11, 2010 20:28
-
-
Save robyurkowski/471810 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSessionsController < ApplicationController | |
def new | |
@user_session = UserSession.new | |
end | |
def create | |
@user_session = UserSession.new(params[:user_session]) | |
if @user_session.save | |
flash[:notice] = "Logged in successfully." | |
redirect_to_target_or_default(root_url) | |
else | |
render :action => 'new' | |
end | |
end | |
def destroy | |
@user_session = UserSession.find | |
@user_session.destroy | |
flash[:notice] = "You have been logged out." | |
redirect_to root_url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment