Remove references to prototype (inexistent in OFN) in model properties

This commit is contained in:
luisramos0
2019-11-08 17:49:35 +00:00
parent 215f2897f3
commit de1d7f2877

View File

@@ -1,7 +1,5 @@
module Spree
class Property < ActiveRecord::Base
has_and_belongs_to_many :prototypes, join_table: 'spree_properties_prototypes'
has_many :product_properties, dependent: :destroy
has_many :products, through: :product_properties
@@ -10,12 +8,5 @@ module Spree
validates :name, :presentation, presence: true
scope :sorted, -> { order(:name) }
def self.find_all_by_prototype(prototype)
id = prototype
id = prototype.id if prototype.class == Prototype
joins("LEFT JOIN properties_prototypes ON property_id = #{self.table_name}.id").
where(prototype_id: id)
end
end
end