merge with master

This commit is contained in:
Yan
2017-07-12 17:58:07 +06:30
parent 6546b8020a
commit 9da05a72aa
3 changed files with 5 additions and 5 deletions

View File

@@ -1,12 +1,12 @@
class MenuCategory < ApplicationRecord
# before_create :generate_menu_category_code
before_create :generate_menu_category_code
belongs_to :menu
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true
has_many :menu_items
validates_presence_of :name, :menu, :code, :order_by
validates_presence_of :name, :menu, :order_by
default_scope { order('order_by asc') }

View File

@@ -1,6 +1,6 @@
class MenuItem < ApplicationRecord
# before_create :generate_menu_item_code
before_create :generate_menu_item_code
belongs_to :menu_category, :optional => true
has_many :menu_item_instances
@@ -8,7 +8,7 @@ class MenuItem < ApplicationRecord
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
belongs_to :account
validates_presence_of :item_code, :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
validates_presence_of :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
default_scope { order('item_code asc') }

View File

@@ -1,6 +1,6 @@
class MenuItemInstance < ApplicationRecord
belongs_to :menu_item
# before_create :generate_menu_item_instance_code
before_create :generate_menu_item_instance_code
def self.findParentCategory(item)
if item.menu_category_id