adds search to Booth model
This commit is contained in:
@@ -4,5 +4,10 @@ class Poll
|
||||
has_many :polls, through: :booth_assignments
|
||||
|
||||
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}%")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user