app/controllers/spree/admin/variants_controller.rb in solidus_backend-2.10.5 vs app/controllers/spree/admin/variants_controller.rb in solidus_backend-2.11.0
- old
+ new
@@ -19,11 +19,11 @@
@object.default_price = @object.product.master.default_price.clone
end
def collection
if params[:deleted] == "on"
- base_variant_scope ||= super.with_deleted
+ base_variant_scope ||= super.with_discarded
else
base_variant_scope ||= super
end
search = Spree::Config.variant_search_class.new(params[:variant_search_term], scope: base_variant_scope)
@@ -41,11 +41,13 @@
def redirect_on_empty_option_values
redirect_to admin_product_variants_url(params[:product_id]) if @product.empty_option_values?
end
def parent
- @parent ||= Spree::Product.with_deleted.find_by(slug: params[:product_id])
+ @parent ||= Spree::Product.with_discarded.find_by!(slug: params[:product_id])
@product = @parent
+ rescue ActiveRecord::RecordNotFound
+ resource_not_found(flash_class: Spree::Product, redirect_url: admin_products_path)
end
end
end
end