Module: Toy::AssociationSerialization
- Extended by:
- ActiveSupport::Concern
- Includes:
- Serialization
- Included in:
- Store
- Defined in:
- lib/toy/association_serialization.rb
Instance Method Summary collapse
Methods included from Serialization
Instance Method Details
#serializable_hash(options = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/toy/association_serialization.rb', line 6 def serializable_hash( = nil) ||= {} super.tap { |hash| serializable_add_includes() do |association, records, opts| hash[association] = records.is_a?(Enumerable) ? records.map { |r| r.serializable_hash(opts) } : records.serializable_hash(opts) end } end |