Commit 118f69e4 by Ivan Lan

Fix Order :incr_snapshot_ids

parent 77d31461
......@@ -148,13 +148,21 @@ module Shotengai
end
# into order
def incr_snapshot_ids= ids
ActiveRecord::Base.transaction do
ids.each { |id|
# using update(shotengai_order_id: id) can not get self.id before save
Shotengai::Snapshot.find(id).update!(shotengai_order: self)
}
end
# def incr_snapshot_ids= ids
# ActiveRecord::Base.transaction do
# ids.each { |id|
# # using update(shotengai_order_id: id) can not get self.id before save
# Shotengai::Snapshot.find(id).update!(shotengai_order: self)
# }
# end
# end
attr_accessor :incr_snapshot_ids
after_save(if: :incr_snapshot_ids) do
Array(incr_snapshot_ids).each { |id|
Shotengai::Snapshot.find(id).update!(shotengai_order: self)
}
end
# back to cart
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment