Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
class Commission < ApplicationRecord
|
||||
belongs_to :menu_item, foreign_key: 'product_id'
|
||||
has_many :commissioners
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
class Commissioner < ApplicationRecord
|
||||
has_many :employees
|
||||
belongs_to :employee, foreign_key: 'emp_id'
|
||||
belongs_to :commission, foreign_key: 'commission_type'
|
||||
scope :active, -> { where(is_active: true) }
|
||||
end
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
class Employee < ApplicationRecord
|
||||
has_secure_password
|
||||
belongs_to :commissioner
|
||||
has_many :commissioners
|
||||
has_many :shit_sales
|
||||
|
||||
validates_presence_of :name, :role
|
||||
validates_presence_of :password, :on => [:create]
|
||||
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||
|
||||
@@ -3,6 +3,8 @@ class MenuItem < ApplicationRecord
|
||||
|
||||
belongs_to :menu_category, :optional => true
|
||||
has_many :menu_item_instances
|
||||
has_many :commissions
|
||||
|
||||
# belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||
# has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||
belongs_to :account
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Product < ApplicationRecord
|
||||
validates_presence_of :name
|
||||
|
||||
|
||||
# Product Image Uploader
|
||||
mount_uploader :image_path, ProductImageUploader
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user