From 41ff406e86e05d3126ce31aa59c5df56fe4646fa Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Mon, 22 Jun 2020 15:33:47 +0100 Subject: [PATCH] Fix rubocop issue by avoiding rails method name update_attributes --- app/models/spree/product_set.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/spree/product_set.rb b/app/models/spree/product_set.rb index 408021c8e4..4731c44bf7 100644 --- a/app/models/spree/product_set.rb +++ b/app/models/spree/product_set.rb @@ -5,7 +5,7 @@ class Spree::ProductSet < ModelSet def save @collection_hash.each_value.all? do |product_attributes| - update_attributes(product_attributes) + update_product_attributes(product_attributes) end end @@ -18,19 +18,19 @@ class Spree::ProductSet < ModelSet private # A separate method of updating products was required due to an issue with - # the way Rails' assign_attributes and updates_attributes behave when + # the way Rails' assign_attributes and update behave when # delegated attributes of a nested object are updated via the parent object # (ie. price of variants). Updating such attributes by themselves did not # work using: # - # product.update_attributes(variants_attributes: [{ id: y, price: xx.x }]) + # product.update(variants_attributes: [{ id: y, price: xx.x }]) # - # and so an explicit call to update attributes on each individual variant was + # and so an explicit call to update on each individual variant was # required. ie: # - # variant.update_attributes( { price: xx.x } ) + # variant.update( { price: xx.x } ) # - def update_attributes(attributes) + def update_product_attributes(attributes) split_taxon_ids!(attributes) product = find_model(@collection, attributes[:id])