Implements searching in proposals

This commit is contained in:
kikito
2015-09-12 18:35:45 +02:00
parent c44e709f24
commit 849a2c83a8
5 changed files with 41 additions and 0 deletions

View File

@@ -65,6 +65,10 @@ class Proposal < ActiveRecord::Base
6000
end
def self.search(terms)
terms.present? ? where("title ILIKE ? OR description ILIKE ? OR question ILIKE ?", "%#{terms}%", "%#{terms}%", "%#{terms}%") : none
end
def editable?
total_votes <= Setting.value_for("max_votes_for_proposal_edit").to_i
end