Class: ActiveResponse::Responders::JsonApi
- Defined in:
- lib/active_response/responders/json_api.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from JSON
#destroyed, #form, #new_resource, #updated_resource
Methods inherited from HTML
#destroyed, #form, #new_resource, #redirect, #updated_resource
Methods inherited from Base
available_formats, #initialize, respond_to, type, #type
Constructor Details
This class inherits a constructor from ActiveResponse::Responders::Base
Instance Method Details
#collection(**opts) ⇒ Object
8 9 10 11 |
# File 'lib/active_response/responders/json_api.rb', line 8 def collection(**opts) opts[:adapter] = :json_api super end |
#invalid_resource(**opts) ⇒ Object
13 14 15 |
# File 'lib/active_response/responders/json_api.rb', line 13 def invalid_resource(**opts) controller.render json: {errors: formatted_errors(opts[:resource].errors)}, status: :unprocessable_entity end |
#resource(**opts) ⇒ Object
17 18 19 20 |
# File 'lib/active_response/responders/json_api.rb', line 17 def resource(**opts) opts[:adapter] = :json_api super end |