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
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
order.rb
lib/shotengai/order.rb
+15
-7
No files found.
lib/shotengai/order.rb
View file @
118f69e4
...
...
@@ -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
...
...
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