Sha256: 09ea0a57e58edef534250b98c3bc7e58d6b1aea99978e3a73f42955894108216

Contents?: true

Size: 417 Bytes

Versions: 26

Compression:

Stored size: 417 Bytes

Contents

module Spree
  class Property < Spree::Base
    has_many :product_properties, dependent: :delete_all, inverse_of: :property
    has_many :products, through: :product_properties

    validates :name, :presentation, presence: true

    scope :sorted, -> { order(:name) }

    after_touch :touch_all_products

    private

    def touch_all_products
      products.update_all(updated_at: Time.current)
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
solidus_core-2.2.0 app/models/spree/property.rb
solidus_core-2.2.0.rc1 app/models/spree/property.rb
solidus_core-2.2.0.beta1 app/models/spree/property.rb
solidus_core-2.1.0 app/models/spree/property.rb
solidus_core-2.1.0.rc1 app/models/spree/property.rb
solidus_core-2.1.0.beta1 app/models/spree/property.rb