Apply Rails/FindBy rubocop rule
We were already using it in most places.
This commit is contained in:
@@ -22,11 +22,11 @@ class Poll::Ballot < ApplicationRecord
|
||||
end
|
||||
|
||||
def ballot
|
||||
Budget::Ballot.where(poll_ballot: self).first
|
||||
Budget::Ballot.find_by(poll_ballot: self)
|
||||
end
|
||||
|
||||
def find_investment(investment_id)
|
||||
ballot.budget.investments.where(id: investment_id).first
|
||||
ballot.budget.investments.find_by(id: investment_id)
|
||||
end
|
||||
|
||||
def not_already_added?(investment)
|
||||
|
||||
@@ -23,7 +23,7 @@ class Poll
|
||||
end
|
||||
|
||||
def assignment_on_poll(poll)
|
||||
booth_assignments.where(poll: poll).first
|
||||
booth_assignments.find_by(poll: poll)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -56,7 +56,7 @@ class Poll
|
||||
def fill_stats_fields
|
||||
if in_census?
|
||||
self.gender = census_api_response.gender
|
||||
self.geozone_id = Geozone.select(:id).where(census_code: census_api_response.district_code).first&.id
|
||||
self.geozone_id = Geozone.select(:id).find_by(census_code: census_api_response.district_code)&.id
|
||||
self.age = voter_age(census_api_response.date_of_birth)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user