mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Rails 5 introduced this new class to confine application-specific monkey patches to our models only, and not leak into other libraries using ActiveRecord::Base. https://bigbinary.com/blog/application-record-in-rails-5
16 lines
330 B
Ruby
16 lines
330 B
Ruby
module Spree
|
|
class Property < ApplicationRecord
|
|
has_many :product_properties, dependent: :destroy
|
|
has_many :products, through: :product_properties
|
|
has_many :producer_properties
|
|
|
|
validates :name, :presentation, presence: true
|
|
|
|
scope :sorted, -> { order(:name) }
|
|
|
|
def property
|
|
self
|
|
end
|
|
end
|
|
end
|