Module: OptionsModel::Concerns::Serialization
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/options_model/concerns/serialization.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#to_h ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/options_model/concerns/serialization.rb', line 6 def to_h hash = {} hash.merge! unused_attributes if self.class.with_unused_attributes? hash.merge! attributes hash.merge! nested_attributes.reduce({}) { |h, (k, v)| h[k] = v.to_h; h } hash end |