From 9d23c0d9e2caafe04fe06fe3d85da7c855153d4d Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sat, 1 May 2021 16:20:36 +0100 Subject: [PATCH] Reorder has_many relationship with :through option If it's using :through it should be defined after the relationship it's connected to --- app/models/spree/option_type.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/spree/option_type.rb b/app/models/spree/option_type.rb index 3c03976ec3..fe0ea71138 100644 --- a/app/models/spree/option_type.rb +++ b/app/models/spree/option_type.rb @@ -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") }