validate employee id uniqueness by shop_code
This commit is contained in:
@@ -8,7 +8,7 @@ class Employee < ApplicationRecord
|
||||
|
||||
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
|
||||
validates :emp_id, uniqueness: { scope: :shop_code }, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
||||
|
||||
before_create :generate_app_id, :generate_app_token,
|
||||
|
||||
Reference in New Issue
Block a user