Class: ApiGuard::RegistrationController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api_guard/registration_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_resource

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/api_guard/registration_controller.rb', line 7

def create
  init_resource()
  if resource.save
    create_token_and_set_header(resource, resource_name)
    render_success(message: I18n.t('api_guard.registration.signed_up'))
  else
    render_error(422, object: resource)
  end
end

#destroyObject



17
18
19
20
# File 'app/controllers/api_guard/registration_controller.rb', line 17

def destroy
  current_resource.destroy
  render_success(message: I18n.t('api_guard.registration.account_deleted'))
end