Photo Field in Customer,Employee and Commissionor

This commit is contained in:
San Wai Lwin
2018-03-07 17:50:23 +06:30
parent 9f29bbef5a
commit 9ec8c4d18c
19 changed files with 360 additions and 9 deletions

View File

@@ -7,4 +7,7 @@ class Commissioner < ApplicationRecord
# validations
validates_presence_of :name
# Commissioner Image Uploader
mount_uploader :image_path, CommissionerImageUploader
end

View File

@@ -2,6 +2,9 @@ class Customer < ApplicationRecord
#self.primary_key = :customer_id
# Customer Image Uploader
mount_uploader :image_path, CustomerImageUploader
before_create :generate_custom_id
has_many :orders
has_many :sales

View File

@@ -8,6 +8,9 @@ class Employee < ApplicationRecord
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
# Employee Image Uploader
mount_uploader :image_path, EmployeeImageUploader
def self.all_emp_except_waiter
Employee.where('role!=?','waiter')
end