Class: RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
Curate::ThemedLayoutController
Defined in:
app/controllers/registrations_controller.rb

Instance Method Summary collapse

Methods included from Curate::ThemedLayoutController

#show_site_actions?, #show_site_search?

Instance Method Details

#updateObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/registrations_controller.rb', line 5

def update
  if current_user.manager?
    self.resource = resource_class.to_adapter.get!(User.find(params[:user][:id]))
  else
    self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
  end
  prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)

  if current_user.manager?
    if [:password].blank?
      .delete("password")
      .delete("password_confirmation")
    end
    successfully_updated = resource.update_without_password()
  else
    successfully_updated = update_resource(resource, )
  end

  if successfully_updated
    yield resource if block_given?
    if is_flashing_format?
      flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
        :update_needs_confirmation : :updated
      set_flash_message :notice, flash_key
    end
     resource_name, resource, bypass: true unless current_user.manager?
    respond_with resource, location: after_update_path_for(resource)
  else
    clean_up_passwords resource
    respond_with resource
  end
end