Skip to content

Instantly share code, notes, and snippets.

@JonasNielsen
Created March 21, 2010 19:47
Show Gist options
  • Save JonasNielsen/339517 to your computer and use it in GitHub Desktop.
Save JonasNielsen/339517 to your computer and use it in GitHub Desktop.
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] = "Successfully logged in."
redirect_to root_url
else
render :action => 'new'
end
end
def destroy
@user_session = UserSession.find
@user_session.destroy
flash[:notice] = "Successfully 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