Skip to content

Instantly share code, notes, and snippets.

@keeperofthenecklace
Created August 18, 2012 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keeperofthenecklace/3388729 to your computer and use it in GitHub Desktop.
Save keeperofthenecklace/3388729 to your computer and use it in GitHub Desktop.
spec/controller/sessions_controller
class SessionsController < ApplicationController
def new
end
def create
user = User.find_by_email(params[:session][:email])
if user && user.authenticate(params[:session][:password])
sign_in user
redirect_to user
else
flash.now[:error] = 'Invalid email/password combination'
render 'new'
end
end
def destroy
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment