optimize for dashboards

This commit is contained in:
Thein Lin Kyaw
2019-11-18 10:09:40 +06:30
parent d94dde63fe
commit a3e4cc8993
10 changed files with 321 additions and 807 deletions

View File

@@ -11,11 +11,11 @@ class MenuItem < ApplicationRecord
belongs_to :account
has_many :menu_item_sets
has_many :item_sets, through: :menu_item_sets
has_and_belongs_to_many :item_sets, join_table: "menu_item_sets"
validates_presence_of :item_code, :name, :type, :min_qty,:account_id
validates_uniqueness_of :item_code
default_scope { order('item_code asc') }
scope :simple_menu_item, -> { where(type: 'SimpleMenuItem') }