Commit 4e474b98 by ivan Lan

Add Order scope :manager_is

parent aa2eea98
......@@ -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
......
......@@ -35,7 +35,12 @@ 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
......
......@@ -37,7 +37,8 @@ module Shotengai
validate :check_spec_value
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
......
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