Class: SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SessionsController
- Defined in:
- app/controllers/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/sessions_controller.rb', line 4 def create if @user = User.find_by_email(params[:user][:email]).try(:authenticate, params[:user][:password]) sign_in @user redirect_to signed_in_path else @user = User.new flash[:error] = 'bad email/password combination' render :new end end |
#destroy ⇒ Object
15 16 17 18 |
# File 'app/controllers/sessions_controller.rb', line 15 def destroy sign_out redirect_to signed_out_path, notice: 'Logged Out' end |
#new ⇒ Object
20 21 22 |
# File 'app/controllers/sessions_controller.rb', line 20 def new @user = User.new end |