Class: DeviseTokenAuth::ApplicationController

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

Instance Method Summary collapse

Instance Method Details

#resource_data(opts = {}) ⇒ Object



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

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

#resource_errorsObject



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

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