Class: ActiveRecord::Store::IndifferentHashAccessor

Inherits:
HashAccessor show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/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



250
251
252
253
254
255
256
257
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/store.rb', line 250

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