Files
sx-fc/app/models/commissioner.rb
2019-06-18 11:02:01 +06:30

14 lines
381 B
Ruby
Executable File

class Commissioner < ApplicationRecord
belongs_to :employee, foreign_key: 'emp_id'
belongs_to :commission, foreign_key: 'commission_id'
has_many :in_duties
has_many :product_commissions
scope :active, -> { where(is_active: true) }
# validations
validates_presence_of :name
# Commissioner Image Uploader
mount_uploader :image_path, CommissionerImageUploader
end