Module: RactorRailsShim::ActiveRecordModelSchemaPatch::InstanceMethods
- Defined in:
- lib/ractor_rails_shim/patches/active_record_model_schema.rb
Instance Method Summary collapse
-
#_returning_columns_for_insert(connection) ⇒ Object
:nodoc:.
-
#attributes_builder ⇒ Object
:nodoc:.
-
#column_defaults ⇒ Object
:nodoc:.
-
#yaml_encoder ⇒ Object
:nodoc:.
Instance Method Details
#_returning_columns_for_insert(connection) ⇒ Object
:nodoc:
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ractor_rails_shim/patches/active_record_model_schema.rb', line 26 def _returning_columns_for_insert(connection) # :nodoc: key = :"rrs_returning_cols_#{object_id}" ActiveSupport::IsolatedExecutionState[key] ||= begin auto_populated_columns = columns.filter_map do |c| c.name if connection.return_value_after_insert?(c) end auto_populated_columns.empty? ? Array(primary_key) : auto_populated_columns end end |
#attributes_builder ⇒ Object
:nodoc:
37 38 39 40 41 42 43 |
# File 'lib/ractor_rails_shim/patches/active_record_model_schema.rb', line 37 def attributes_builder # :nodoc: key = :"rrs_attributes_builder_#{object_id}" ActiveSupport::IsolatedExecutionState[key] ||= begin defaults = _default_attributes.except(*(column_names - [primary_key])) ::ActiveModel::AttributeSet::Builder.new(attribute_types, defaults) end end |
#column_defaults ⇒ Object
:nodoc:
45 46 47 48 49 |
# File 'lib/ractor_rails_shim/patches/active_record_model_schema.rb', line 45 def column_defaults # :nodoc: key = :"rrs_column_defaults_#{object_id}" ActiveSupport::IsolatedExecutionState[key] ||= _default_attributes.deep_dup.to_hash.freeze end |
#yaml_encoder ⇒ Object
:nodoc:
51 52 53 54 55 |
# File 'lib/ractor_rails_shim/patches/active_record_model_schema.rb', line 51 def yaml_encoder # :nodoc: key = :"rrs_yaml_encoder_#{object_id}" ActiveSupport::IsolatedExecutionState[key] ||= ::ActiveModel::AttributeSet::YAMLEncoder.new(attribute_types) end |