diff --git a/app/models/quiz.rb b/app/models/quiz.rb index bf967e4..7c2c5c1 100644 --- a/app/models/quiz.rb +++ b/app/models/quiz.rb @@ -2,7 +2,7 @@ class Quiz < ApplicationRecord has_many :questions, -> { order(:sort) } has_many :candidates - validates_presence_of :name - validates_presence_of :dept - validates_presence_of :unit + validates :name, presence: true, uniqueness: true + validates :dept, presence: true + validates :unit, presence: true end diff --git a/app/models/user.rb b/app/models/user.rb index 781cfac..3b0c1b1 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,9 +2,9 @@ class User < ApplicationRecord has_secure_password has_many :candidates, foreign_key: "recruiter_id" - validates_presence_of :email - validates_presence_of :name - validates_presence_of :role + validates :email, presence: true, uniqueness: true + validates :name, presence: true + validates :role, presence: true validates :reset_token, uniqueness: true, allow_nil: true def setup_reset diff --git a/db/seeds.rb b/db/seeds.rb index e9590a6..e1186d7 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -13,4 +13,8 @@ User.create( role: 'admin' ) -Quiz.create(unit: 'FED', dept: 'PDR') +Quiz.create( + name: 'PDR Standard FED Screening', + unit: 'FED', + dept: 'PDR' +)