update model for menu

This commit is contained in:
Yan
2017-08-11 14:23:33 +06:30
parent b7cde3125f
commit 12d3e70b19
4 changed files with 12 additions and 0 deletions

View File

@@ -1,2 +1,7 @@
class ItemSet < ApplicationRecord
has_many :menu_item_sets
has_many :menu_items, through: :menu_item_sets
has_many :menu_instance_item_sets
has_many :menu_item_instances, through: :menu_item_sets
end

View File

@@ -1,2 +1,4 @@
class MenuInstanceItemSet < ApplicationRecord
belongs_to :item_set
belongs_to :menu_item_instance
end

View File

@@ -8,6 +8,9 @@ class MenuItem < ApplicationRecord
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
belongs_to :account
has_many :menu_item_sets
has_many :item_sets, through: :menu_item_sets
validates_presence_of :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
default_scope { order('item_code asc') }

View File

@@ -1,2 +1,4 @@
class MenuItemSet < ApplicationRecord
belongs_to :item_set
belongs_to :menu_item
end