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



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/active_record/attribute_methods/serialization.rb', line 104

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