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



115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/active_record/attribute_methods/serialization.rb', line 115

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