Class: ActiveRecord::Store::IndifferentHashAccessor

Inherits:
HashAccessor
  • Object
show all
Defined in:
lib/active_record/store.rb

Overview

:nodoc:

Class Method Summary collapse

Methods inherited from HashAccessor

read, write

Class Method Details

.prepare(object, store_attribute) ⇒ Object



169
170
171
172
173
174
175
176
# File 'lib/active_record/store.rb', line 169

def self.prepare(object, store_attribute)
  attribute = object.send(store_attribute)
  unless attribute.is_a?(ActiveSupport::HashWithIndifferentAccess)
    attribute = IndifferentCoder.as_indifferent_hash(attribute)
    object.send :"#{store_attribute}=", attribute
  end
  attribute
end