Merge pull request #7528 from Matt-Yorkley/has_many_through

Reorder has_many relationship with :through option
This commit is contained in:
Andy Brett
2021-05-05 08:08:15 -07:00
committed by GitHub

View File

@@ -2,9 +2,9 @@
module Spree
class OptionType < ApplicationRecord
has_many :products, through: :product_option_types
has_many :option_values, -> { order(:position) }, dependent: :destroy
has_many :product_option_types, dependent: :destroy
has_many :products, through: :product_option_types
validates :name, :presentation, presence: true
default_scope -> { order("#{table_name}.position") }