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
4e474b98
Commit
4e474b98
authored
Mar 15, 2018
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Order scope :manager_is
parent
aa2eea98
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
orders_controller.rb
lib/shotengai/controller/merchant/orders_controller.rb
+1
-1
order.rb
lib/shotengai/order.rb
+5
-0
snapshot.rb
lib/shotengai/snapshot.rb
+1
-0
No files found.
lib/shotengai/controller/merchant/orders_controller.rb
View file @
4e474b98
...
...
@@ -8,7 +8,7 @@ module Shotengai
remove_actions
:create
,
:destroy
def
default_query
resources
@manager
.
orders
resources
.
manager_is
(
@manager
)
end
def
index_query
resources
...
...
lib/shotengai/order.rb
View file @
4e474b98
...
...
@@ -36,6 +36,11 @@ module Shotengai
default_scope
{
where
.
not
(
status:
'cart'
).
order
(
updated_at: :desc
)
}
scope
:status_is
,
->
(
status
)
{
where
(
status
.
blank?
.!
&&
{
status:
status
})
}
scope
:manager_is
,
->
(
manager
)
{
joins
(
:snapshots
).
where
(
shotengai_snapshots:
{
manager_id:
manager
.
id
,
manager_type:
manager
.
class
.
name
}
).
distinct
}
after_create
:set_seq
include
AASM_DLC
...
...
lib/shotengai/snapshot.rb
View file @
4e474b98
...
...
@@ -38,6 +38,7 @@ module Shotengai
validate
:check_remark_value
,
unless: :remark_template_empty?
validates
:count
,
numericality:
{
only_integer:
true
,
greater_than:
0
}
# spec_value accepts harray, other xx_value accespt hash
harray_accessor
:spec_value
,
decode:
true
template_with_value_getters
:spec
,
:remark
,
:info
,
:detail_info
,
delegate_template_to: :shotengai_series
...
...
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