Class: Gaku::Devise::RegistrationsController
- Inherits:
-
Devise::RegistrationsController
- Object
- Devise::RegistrationsController
- Gaku::Devise::RegistrationsController
- Defined in:
- app/controllers/gaku/devise/registrations_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/gaku/devise/registrations_controller.rb', line 10 def create build_resource(user_params) if resource.save if resource.active_for_authentication? :notice, :signed_up if sign_up(resource_name, resource) respond_with resource, location: after_sign_up_path_for(resource) else :notice, :"signed_up_but_#{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 respond_with resource end end |
#create_admin ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/gaku/devise/registrations_controller.rb', line 29 def create_admin build_resource(user_params) admin_role = Gaku::Role.where(name: 'Admin').first_or_create! resource.roles << admin_role if resource.save if resource.active_for_authentication? :notice, :signed_up if sign_up(resource_name, resource) respond_with resource, location: after_sign_up_path_for(resource) else :notice, :"signed_up_but_#{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 respond_with resource end end |
#set_up_admin_account ⇒ Object
5 6 7 8 |
# File 'app/controllers/gaku/devise/registrations_controller.rb', line 5 def set_up_admin_account resource = build_resource({}) respond_with resource end |