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

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

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



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/active_record/attribute_methods/serialization.rb', line 120

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