We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 592aba1 commit 14ac63aCopy full SHA for 14ac63a
1 file changed
app/jobs/item_sync_job.rb
@@ -1,3 +1,5 @@
1
+# frozen_string_literal: true
2
+
3
require 'amazon_product_api'
4
5
# This job is responsible for syncing items with Amazon.
@@ -32,11 +34,10 @@ def sync!(item)
32
34
Rails.logger.info green("Syncing item #{item.id}: #{item.name}")
33
35
update_hash = amazon_item!(item).update_hash
36
item.assign_attributes(update_hash)
37
+ return unless item.changed?
38
- if item.changed?
- Rails.logger.info bold_green("Changed:\n") + item.changes.pretty_inspect
- item.save!
39
- end
+ Rails.logger.info bold_green("Changed:\n") + item.changes.pretty_inspect
40
+ item.save!
41
end
42
43
def amazon_item!(item)
0 commit comments