Module: ActiveRecord::AttributeMethods::Serialization::Behavior::ClassMethods

Defined in:
activerecord/lib/active_record/attribute_methods/serialization.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#initialize_attributes(attributes, options = {}) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
# File 'activerecord/lib/active_record/attribute_methods/serialization.rb', line 97

def initialize_attributes(attributes, options = {})
  serialized = (options.delete(:serialized) { true }) ? :serialized : :unserialized
  super(attributes, options)

  serialized_attributes.each do |key, coder|
    if attributes.key?(key)
      attributes[key] = Attribute.new(coder, attributes[key], serialized)
    end
  end

  attributes
end