Menu 2nd Phrase

This commit is contained in:
PhyoTheingi
2017-05-31 18:27:31 +06:30
parent fda69012da
commit a67c76d945
13 changed files with 80 additions and 52 deletions

View File

@@ -1,8 +1,8 @@
class Menu < ApplicationRecord
has_many :menu_categories, dependent: :destroy
validates_presence_of :name, :is_active, :valid_days, :valid_time_from, :valid_time_to
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
#Default Scope to pull the active version only
default_scope { where(is_active: true).order("created_at desc") }