Add search method to polls

So far the method does not take questions nor answers into account.

This way we'll be able to search polls in the SDG Management section.
This commit is contained in:
Javi Martín
2020-12-16 14:24:24 +01:00
parent 00910b82a3
commit 852014e478
7 changed files with 75 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ class Poll < ApplicationRecord
acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases
include Notifiable
include Searchable
include Sluggable
include StatsVersionable
include Reportable
@@ -175,4 +176,20 @@ class Poll < ApplicationRecord
def budget_poll?
budget.present?
end
def searchable_translations_definitions
{
name => "A",
summary => "C",
description => "D"
}
end
def searchable_values
searchable_globalized_values
end
def self.search(terms)
pg_search(terms)
end
end