Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
118f69e4
Commit
118f69e4
authored
Sep 12, 2018
by
Ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Order :incr_snapshot_ids
parent
77d31461
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
order.rb
lib/shotengai/order.rb
+13
-5
No files found.
lib/shotengai/order.rb
View file @
118f69e4
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment