Class: DeviseTokenAuth::ApplicationController

Inherits:
DeviseController
  • Object
show all
Includes:
Concerns::SetUserByToken
Defined in:
app/controllers/devise_token_auth/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#resource_data(opts = {}) ⇒ Object



7
8
9
10
11
# File 'app/controllers/devise_token_auth/application_controller.rb', line 7

def resource_data(opts = {})
  response_data = opts[:resource_json] || @resource.as_json
  response_data['type'] = @resource.class.name.parameterize if json_api?
  response_data
end

#resource_errorsObject



13
14
15
# File 'app/controllers/devise_token_auth/application_controller.rb', line 13

def resource_errors
  @resource.errors.to_hash.merge(full_messages: @resource.errors.full_messages)
end