Module: JSONAPI::Rails
- Defined in:
- lib/jsonapi/rails/parser.rb,
lib/jsonapi/rails/railtie.rb,
lib/jsonapi/rails/renderer.rb,
lib/jsonapi/rails/action_controller.rb
Defined Under Namespace
Modules: ActionController Classes: ErrorRenderer, Railtie, SuccessRenderer
Class Method Summary collapse
Class Method Details
.parser ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/jsonapi/rails/parser.rb', line 5 def parser lambda do |body| data = JSON.parse(body) data = { _json: data } unless data.is_a?(Hash) data.with_indifferent_access end end |
.rails_renderer(renderer) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 34 35 |
# File 'lib/jsonapi/rails/renderer.rb', line 29 def rails_renderer(renderer) proc do |json, | json = renderer.render(json, ) unless json.is_a?(String) self.content_type ||= Mime[:jsonapi] self.response_body = json end end |