From a70b2a12d1c034386e7855444ef7b63cc6e30fa0 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 21 Mar 2021 13:20:25 +0000 Subject: [PATCH] Update variants controller callback --- app/controllers/spree/admin/variants_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/spree/admin/variants_controller.rb b/app/controllers/spree/admin/variants_controller.rb index 2177080a8f..c11c89b5af 100644 --- a/app/controllers/spree/admin/variants_controller.rb +++ b/app/controllers/spree/admin/variants_controller.rb @@ -4,9 +4,9 @@ module Spree module Admin class VariantsController < ::Admin::ResourceController helper 'spree/products' - belongs_to 'spree/product', find_by: :permalink - new_action.before :new_before + + before_action :assign_default_attributes, only: :new def index @url_filters = ::ProductFilters.new.extract(request.query_parameters) @@ -84,7 +84,7 @@ module Spree @object.save end - def new_before + def assign_default_attributes @object.attributes = @object.product.master. attributes.except('id', 'created_at', 'deleted_at', 'sku', 'is_master') # Shallow Clone of the default price to populate the price field.