Sha256: b7858e56d7c7f308c3e5fef920be9323a9ca61f4ac2c64d49fbfd2849cd1a50b

Contents?: true

Size: 672 Bytes

Versions: 24

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

require "store_model/ext/parent_assignment"

module StoreModel
  # ActiveModel::Attributes patch with parent tracking support
  module Attributes
    include ParentAssignment

    private

    def attribute(*)
      super.tap do |value|
        assign_parent_to_store_model_relation(value)
      end
    end

    if Rails::VERSION::MAJOR >= 7
      def _write_attribute(*)
        super.tap do |value|
          assign_parent_to_store_model_relation(value)
        end
      end
    else
      def write_attribute(*)
        super.tap do |value|
          assign_parent_to_store_model_relation(value)
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
store_model-4.2.0 lib/store_model/ext/active_model/attributes.rb
store_model-4.1.0 lib/store_model/ext/active_model/attributes.rb
store_model-4.0.0 lib/store_model/ext/active_model/attributes.rb
store_model-3.0.2 lib/store_model/ext/active_model/attributes.rb
store_model-3.0.1 lib/store_model/ext/active_model/attributes.rb
store_model-3.0.0 lib/store_model/ext/active_model/attributes.rb
store_model-2.4.0 lib/store_model/ext/active_model/attributes.rb
store_model-2.3.0 lib/store_model/ext/active_model/attributes.rb
store_model-2.2.0 lib/store_model/ext/active_model/attributes.rb
store_model-2.1.2 lib/store_model/ext/active_model/attributes.rb
store_model-2.1.1 lib/store_model/ext/active_model/attributes.rb
store_model-2.1.0 lib/store_model/ext/active_model/attributes.rb
store_model-2.0.1 lib/store_model/ext/active_model/attributes.rb
store_model-2.0.0 lib/store_model/ext/active_model/attributes.rb
store_model-1.6.2 lib/store_model/ext/active_model/attributes.rb
store_model-1.6.1 lib/store_model/ext/active_model/attributes.rb
store_model-1.6.0 lib/store_model/ext/active_model/attributes.rb
store_model-1.5.1 lib/store_model/ext/active_model/attributes.rb
store_model-1.5.0 lib/store_model/ext/active_model/attributes.rb
store_model-1.4.0 lib/store_model/ext/active_model/attributes.rb