Merge branch 'settings_backend' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -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") }
|
||||
|
||||
|
||||
@@ -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') }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user