Module: Roar::JSON::JSONAPI::ForCollection
- Defined in:
- lib/roar/json/json_api.rb
Instance Method Summary collapse
-
#for_collection ⇒ Object
same API as representable.
Instance Method Details
#for_collection ⇒ Object
same API as representable. TODO: we could use ::collection_representer! here.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/roar/json/json_api.rb', line 26 def for_collection # same API as representable. TODO: we could use ::collection_representer! here. singular = self # e.g. Song::Representer # this basically does Module.new { include Hash::Collection .. } build_inline(nil, [Representable::Hash::Collection, Document::Collection, Roar::JSON], "", {}) do items extend: singular, :parse_strategy => :sync representable_attrs[:resource_representer] = singular.representable_attrs[:resource_representer] representable_attrs[:meta_representer] = singular.representable_attrs[:meta_representer] # DISCUSS: do we need that? representable_attrs[:_wrap] = singular.representable_attrs[:_wrap] end end |