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
5a2e875a
Commit
5a2e875a
authored
Sep 22, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all touch: true option of belongs to
parent
30d15ee6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
12 deletions
+12
-12
cart.rb
lib/shotengai/cart.rb
+1
-1
catalog.rb
lib/shotengai/catalog.rb
+1
-1
order.rb
lib/shotengai/order.rb
+2
-2
product.rb
lib/shotengai/product.rb
+1
-1
series.rb
lib/shotengai/series.rb
+2
-2
snapshot.rb
lib/shotengai/snapshot.rb
+5
-5
No files found.
lib/shotengai/cart.rb
View file @
5a2e875a
...
...
@@ -59,7 +59,7 @@ module Shotengai
class_name:
self
.
name
,
optional:
true
,
foreign_key: :shotengai_order_id
,
touch:
true
,
#
touch: true,
)
end
end
...
...
lib/shotengai/catalog.rb
View file @
5a2e875a
...
...
@@ -25,7 +25,7 @@ module Shotengai
class
<<
self
def
inherited
subclass
subclass
.
has_many
:sub_catalogs
,
class_name:
subclass
.
name
,
foreign_key: :super_catalog_id
subclass
.
belongs_to
:super_catalog
,
class_name:
subclass
.
name
,
optional:
true
,
touch:
true
subclass
.
belongs_to
:super_catalog
,
class_name:
subclass
.
name
,
optional:
true
#
, touch: true
# subclass.instance_eval("def klass; #{subclass}; end")
super
end
...
...
lib/shotengai/order.rb
View file @
5a2e875a
...
...
@@ -31,7 +31,7 @@ module Shotengai
class
Order
<
ActiveRecord
::
Base
self
.
table_name
=
'shotengai_orders'
belongs_to
:buyer
,
polymorphic:
true
,
optional:
true
,
touch:
true
belongs_to
:buyer
,
polymorphic:
true
,
optional:
true
#
, touch: true
default_scope
{
where
.
not
(
status:
'cart'
)
}
scope
:status_is
,
->
(
status
)
{
where
(
status
.
blank?
.!
&&
{
status:
status
})
}
...
...
@@ -179,7 +179,7 @@ module Shotengai
class_name:
self
.
name
,
optional:
true
,
foreign_key: :shotengai_order_id
,
touch:
true
,
#
touch: true,
)
end
...
...
lib/shotengai/product.rb
View file @
5a2e875a
...
...
@@ -30,7 +30,7 @@ module Shotengai
require
'acts-as-taggable-on'
self
.
table_name
=
'shotengai_products'
belongs_to
:manager
,
polymorphic:
true
,
optional:
true
,
touch:
true
belongs_to
:manager
,
polymorphic:
true
,
optional:
true
#
, touch: true
validate
:check_spec
,
if: :spec
include
AASM_DLC
...
...
lib/shotengai/series.rb
View file @
5a2e875a
...
...
@@ -52,8 +52,8 @@ module Shotengai
def
add_associations
subclass
,
product_name
# belongs to Product
subclass
.
belongs_to
:product
,
foreign_key: :shotengai_product_id
,
class_name:
product_name
,
touch:
true
subclass
.
belongs_to
product_name
.
underscore
.
to_sym
,
foreign_key: :shotengai_product_id
,
class_name:
product_name
,
touch:
true
subclass
.
belongs_to
:product
,
foreign_key: :shotengai_product_id
,
class_name:
product_name
#
, touch: true
subclass
.
belongs_to
product_name
.
underscore
.
to_sym
,
foreign_key: :shotengai_product_id
,
class_name:
product_name
#
, touch: true
# has many snapshot
subclass
.
has_many
:snapshots
,
class_name:
"
#{
product_name
}
Snapshot"
,
foreign_key: :shotengai_series_id
end
...
...
lib/shotengai/snapshot.rb
View file @
5a2e875a
...
...
@@ -35,9 +35,9 @@ module Shotengai
validate
:cannot_edit_if_order_is_paid
belongs_to
:shotengai_order
,
foreign_key: :shotengai_order_id
,
class_name:
'Shotengai::Order'
,
optional:
true
,
touch:
true
class_name:
'Shotengai::Order'
,
optional:
true
#
, touch: true
belongs_to
:shotengai_cart
,
foreign_key: :shotengai_order_id
,
class_name:
'Shotengai::Cart'
,
optional:
true
,
touch:
true
class_name:
'Shotengai::Cart'
,
optional:
true
#
, touch: true
scope
:in_order
,
->
{
joins
(
:shotengai_order
).
where
.
not
(
shotengai_orders:
{
status:
'cart'
})
}
scope
:in_cart
,
->
{
joins
(
:shotengai_order
).
where
(
shotengai_orders:
{
status:
'cart'
})
}
...
...
@@ -47,8 +47,8 @@ module Shotengai
product_name
=
/^(.+)Snapshot/
.
match
(
subclass
.
name
)[
1
]
series_name
=
"
#{
product_name
}
Series"
# belongs to Series
subclass
.
belongs_to
:series
,
foreign_key: :shotengai_series_id
,
class_name:
series_name
,
touch:
true
subclass
.
belongs_to
series_name
.
underscore
.
to_sym
,
foreign_key: :shotengai_series_id
,
class_name:
series_name
,
touch:
true
subclass
.
belongs_to
:series
,
foreign_key: :shotengai_series_id
,
class_name:
series_name
#
, touch: true
subclass
.
belongs_to
series_name
.
underscore
.
to_sym
,
foreign_key: :shotengai_series_id
,
class_name:
series_name
#
, touch: true
# 加载自定义文件
require_custom_file
(
product_name
)
if
Rails
.
root
super
...
...
@@ -61,7 +61,7 @@ module Shotengai
end
delegate
:manager
,
to: :series
# 支付前 信息 delegate to series
%i{
original_price price spec banners
...
...
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