Merge branch 'settings_backend' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-06-02 14:03:40 +06:30
33 changed files with 574 additions and 48 deletions

View File

@@ -2,7 +2,7 @@ class Menu < ApplicationRecord
has_many :menu_categories, dependent: :destroy
validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to
validates_format_of :valid_days, :with => /\A([0-7]{1}(,[0-7]{1})*)?\Z/i, :on => :create
validates_format_of :valid_days, :with => /\A([0-7]{1}(,[0-7]{1})*)?\Z/i
#Default Scope to pull the active version only
default_scope { where(is_active: true).order("created_at desc") }

View File

@@ -3,6 +3,7 @@ class MenuItem < ApplicationRecord
has_many :menu_item_instances
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
validates_presence_of :item_code, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
default_scope { order('item_code asc') }