Module: ActiveModel::Serialization
- Defined in:
- lib/accepts_nested_serialized_attributes.rb
Instance Method Summary collapse
Instance Method Details
#original_serializable_hash ⇒ Object
5 |
# File 'lib/accepts_nested_serialized_attributes.rb', line 5 alias_method :original_serializable_hash, :serializable_hash |
#serializable_hash(options = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/accepts_nested_serialized_attributes.rb', line 7 def serializable_hash( = nil) original_serializable_hash().tap do |hash| hash.symbolize_keys! self.class..keys.each do |nested_attributes_key| if (records = hash.delete nested_attributes_key) hash["#{nested_attributes_key}_attributes".to_sym] = records end end end end |