Commit 118f69e4 by Ivan Lan

Fix Order :incr_snapshot_ids

parent 77d31461
......@@ -148,14 +148,22 @@ 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
# 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
end
# back to cart
def gone_snapshot_ids= ids
......
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