wired up vote ux
This commit is contained in:
@ -17,7 +17,7 @@ class Candidate < ApplicationRecord
|
||||
validates :test_hash, uniqueness: true, presence: true
|
||||
|
||||
enum review_status: {
|
||||
# pending: 0,
|
||||
pending: 0,
|
||||
approved: 1,
|
||||
declined: 2
|
||||
}
|
||||
|
@ -47,6 +47,13 @@ class User < ApplicationRecord
|
||||
candidate.update_attribute(:review_status, :declined) if vote.save
|
||||
end
|
||||
|
||||
def my_vote candidate
|
||||
candidate = Candidate.find(candidate.to_i)
|
||||
|
||||
my_votes = votes.find_by(candidate_id: candidate.id)
|
||||
my_votes.nil? ? "undecided" : my_votes.votes
|
||||
end
|
||||
|
||||
# Roles
|
||||
def admin?
|
||||
'admin' == role
|
||||
|
Reference in New Issue
Block a user