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

get, read, write

Class Method Details

.prepare(object, attribute) ⇒ Object



277
278
279
280
281
282
283
284
285
286
# File 'lib/active_record/store.rb', line 277

def self.prepare(object, attribute)
  store_object = object.public_send(attribute)

  unless store_object.is_a?(ActiveSupport::HashWithIndifferentAccess)
    store_object = IndifferentCoder.as_indifferent_hash(store_object)
    object.public_send :"#{attribute}=", store_object
  end

  store_object
end