Method: EPlat::Concerns::OverwriteInstanceMethods#to_json

Defined in:
lib/e_plat/resource/concerns/overwrite_instance_methods.rb

#to_json(options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/e_plat/resource/concerns/overwrite_instance_methods.rb', line 6

def to_json(options = {})
  #add this option here so root is added at the top of the JSON, as_json to every nested resource
  root_at_top_of_json = self.mapping.include_root_in_request_body?(self)
  options[:root]     = self.element_name if root_at_top_of_json 

  super(options)
end