Class: Locomotive::MyAccountController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/my_account_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



12
13
14
15
# File 'app/controllers/locomotive/my_account_controller.rb', line 12

def edit
  authorize @account
  respond_with @account
end

#regenerate_api_keyObject



28
29
30
31
32
# File 'app/controllers/locomotive/my_account_controller.rb', line 28

def regenerate_api_key
  authorize @account, :update?
  @account.regenerate_api_key!
  respond_with({ api_key: @account.api_key }, location: )
end

#updateObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/locomotive/my_account_controller.rb', line 17

def update
  authorize @account
  if needs_password?
    @account.update_with_password()
  else
    @account.update_attributes()
  end
  params[:active_tab] = 'credentials' if @account.errors.include?(:current_password)
  respond_with @account, location: (anchor: params[:active_tab])
end