Rubocop autocorrections

This commit is contained in:
Bertocq
2017-09-14 13:18:37 +02:00
parent 93323cb917
commit e4e78c8f16
25 changed files with 53 additions and 56 deletions

View File

@@ -5,7 +5,7 @@ class Poll
has_many :shifts
validates :name, presence: true, uniqueness: true
def self.search(terms)
return Booth.none if terms.blank?
Booth.where("name ILIKE ? OR location ILIKE ?", "%#{terms}%", "%#{terms}%")

View File

@@ -1,13 +1,13 @@
class Poll
class Shift < ActiveRecord::Base
belongs_to :booth
belongs_to :officer
belongs_to :booth
belongs_to :officer
validates :booth_id, presence: true
validates :officer_id, presence: true
validates :date, presence: true
validates :date, uniqueness: { scope: [:officer_id, :booth_id] }
before_create :persist_data
after_create :create_officer_assignments
@@ -20,7 +20,7 @@ class Poll
end
end
def persist_data
def persist_data
self.officer_name = officer.name
self.officer_email = officer.email
end