Commit 4240cb07 authored by royce-matthew's avatar royce-matthew

added validation

parent 04fad600
class Candidate < ActiveRecord::Base class Candidate < ActiveRecord::Base
validates :first_name, presence: true
validates :last_name, presence: true
belongs_to :position belongs_to :position
has_many :votes has_many :votes
def full_name def full_name
"#{ self.first_name } #{ self.last_name }" "#{ self.first_name } #{ self.last_name }"
end end
......
class User < ActiveRecord::Base class User < ActiveRecord::Base
# Include default devise modules. Others available are: # Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable # :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable :recoverable, :rememberable, :trackable, :validatable
has_many :votes has_many :votes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment