Class: Devise::RegistrationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Devise::RegistrationsController
- Includes:
- Controllers::InternalHelpers
- Defined in:
- app/controllers/devise/registrations_controller.rb
Constant Summary
Constants included from Controllers::SharedHelpers
Controllers::SharedHelpers::MIME_REFERENCES
Instance Method Summary collapse
-
#cancel ⇒ Object
GET /resource/cancel Forces the session data which is usually expired after sign in to be expired now.
-
#create ⇒ Object
POST /resource.
-
#destroy ⇒ Object
DELETE /resource.
-
#edit ⇒ Object
GET /resource/edit.
-
#new ⇒ Object
GET /resource/sign_up.
-
#update ⇒ Object
PUT /resource We need to use a copy of the resource because we don’t want to change the current user in place.
Methods included from Controllers::InternalHelpers
#devise_controller?, #devise_mapping, #resource, #resource_class, #resource_name, #signed_in_resource
Instance Method Details
#cancel ⇒ Object
GET /resource/cancel Forces the session data which is usually expired after sign in to be expired now. This is useful if the user wants to cancel oauth signing in/up in the middle of the process, removing all OAuth session data.
66 67 68 69 |
# File 'app/controllers/devise/registrations_controller.rb', line 66 def cancel expire_session_data_after_sign_in! redirect_to new_registration_path(resource_name) end |
#create ⇒ Object
POST /resource
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/devise/registrations_controller.rb', line 13 def create build_resource if resource.save if resource.active_for_authentication? :notice, :signed_up if sign_in(resource_name, resource) respond_with resource, :location => redirect_location(resource_name, resource) else :notice, :inactive_signed_up, :reason => inactive_reason(resource) if expire_session_data_after_sign_in! respond_with resource, :location => after_inactive_sign_up_path_for(resource) end else clean_up_passwords(resource) (resource) { render_with_scope :new } end end |
#destroy ⇒ Object
DELETE /resource
54 55 56 57 58 59 |
# File 'app/controllers/devise/registrations_controller.rb', line 54 def destroy resource.destroy Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name) :notice, :destroyed if (resource){ redirect_to after_sign_out_path_for(resource_name) } end |
#edit ⇒ Object
GET /resource/edit
33 34 35 |
# File 'app/controllers/devise/registrations_controller.rb', line 33 def edit render_with_scope :edit end |
#new ⇒ Object
GET /resource/sign_up
7 8 9 10 |
# File 'app/controllers/devise/registrations_controller.rb', line 7 def new resource = build_resource({}) (resource){ render_with_scope :new } end |
#update ⇒ Object
PUT /resource We need to use a copy of the resource because we don’t want to change the current user in place.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/devise/registrations_controller.rb', line 40 def update self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) if resource.update_with_password(params[resource_name]) :notice, :updated if sign_in resource_name, resource, :bypass => true respond_with resource, :location => after_update_path_for(resource) else clean_up_passwords(resource) (resource){ render_with_scope :edit } end end |