Class: Gemgento::User::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Defined in:
app/controllers/gemgento/user/registrations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /resource



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/gemgento/user/registrations_controller.rb', line 4

def create
  build_resource()
  resource.stores << current_store unless resource.stores.include? current_store
  resource.user_group = UserGroup.find_by(code: 'General')
  resource.sync_needed = true

  if resource.save
    yield resource if block_given?
    if resource.active_for_authentication?
      set_flash_message :notice, :signed_up if is_flashing_format?
      (resource_name, resource)
      respond_with resource, location: (resource)
    else
      set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
      expire_data_after_sign_in!
      respond_with resource, location: (resource)
    end
  else
    clean_up_passwords resource
    respond_with resource
  end
end