Class: SessionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SessionsController
- Includes:
- Devise::Controllers::Helpers
- Defined in:
- app/controllers/sessions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /resource/sign_in.
-
#destroy ⇒ Object
GET /resource/sign_out.
-
#new ⇒ Object
GET /resource/sign_in.
Methods included from Devise::Controllers::Helpers
#devise_controller?, #devise_mapping, included, #resource, #resource_class, #resource_name
Instance Method Details
#create ⇒ Object
POST /resource/sign_in
15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/sessions_controller.rb', line 15 def create if authenticate(resource_name) :success, :signed_in redirect_back_or_to home_or_root_path else :failure, :invalid build_resource render :new end end |
#destroy ⇒ Object
GET /resource/sign_out
27 28 29 30 31 |
# File 'app/controllers/sessions_controller.rb', line 27 def destroy :success, :signed_out if signed_in?(resource_name) sign_out(resource_name) redirect_to root_path end |
#new ⇒ Object
GET /resource/sign_in
7 8 9 10 11 12 |
# File 'app/controllers/sessions_controller.rb', line 7 def new Devise::FLASH_MESSAGES.each do |, type| type, if params.key?() end build_resource end |