Module: Para::SearchHelper
- Included in:
- ApplicationHelper, FiltersGenerator
- Defined in:
- app/helpers/para/search_helper.rb
Instance Method Summary collapse
- #filtered?(attributes) ⇒ Boolean
- #fulltext_search_param_for(attributes) ⇒ Object
- #searchable_attributes(attributes) ⇒ Object
Instance Method Details
#filtered?(attributes) ⇒ Boolean
7 8 9 |
# File 'app/helpers/para/search_helper.rb', line 7 def filtered?(attributes) params[:q] && params[:q][fulltext_search_param_for(attributes)].present? end |
#fulltext_search_param_for(attributes) ⇒ Object
3 4 5 |
# File 'app/helpers/para/search_helper.rb', line 3 def fulltext_search_param_for(attributes) "#{ searchable_attributes(attributes) }_cont" end |
#searchable_attributes(attributes) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/para/search_helper.rb', line 11 def searchable_attributes(attributes) whitelist = attributes.select do |attribute| [:string, :text].include?(attribute.type.to_sym) && !attribute.name.match(/password/) end whitelist.map do |attribute| attribute.attribute_column_path.join('_') end.join('_or_') end |