Module: RactorRailsShim::ActiveModelAttributeRegistrationPatch::InstanceMethods

Defined in:
lib/ractor_rails_shim/patches/active_model_attribute.rb

Instance Method Summary collapse

Instance Method Details

#_default_attributesObject

:nodoc:



51
52
53
54
55
56
57
# File 'lib/ractor_rails_shim/patches/active_model_attribute.rb', line 51

def _default_attributes # :nodoc:
  key = :"rrs_default_attributes_#{object_id}"
  ActiveSupport::IsolatedExecutionState[key] ||=
    ::ActiveModel::AttributeSet.new({}).tap do |attribute_set|
      apply_pending_attribute_modifications(attribute_set)
    end
end

#attribute_typesObject

:nodoc:



59
60
61
62
63
64
65
66
# File 'lib/ractor_rails_shim/patches/active_model_attribute.rb', line 59

def attribute_types # :nodoc:
  key = :"rrs_attribute_types_#{object_id}"
  ActiveSupport::IsolatedExecutionState[key] ||= begin
    types = _default_attributes.cast_types
    types.default = ::ActiveModel::Type.default_value
    types
  end
end