Module: Roar::JSON::JSONAPI::Singular

Defined in:
lib/roar/json/json_api.rb

Instance Method Summary collapse

Instance Method Details

#from_hash(hash, options = {}) ⇒ Object



49
50
51
52
# File 'lib/roar/json/json_api.rb', line 49

def from_hash(hash, options={})
  hash["_links"] = hash["links"]
  super
end

#to_hash(options = {}) ⇒ Object



42
43
44
45
46
47
# File 'lib/roar/json/json_api.rb', line 42

def to_hash(options={})
  # per resource:
  super(options.merge(:exclude => [:links])).tap do |hash|
    hash["links"] = hash.delete("_links") if hash["_links"]
  end
end