Module: Releaf::ActionController::Search

Extended by:
ActiveSupport::Concern
Included in:
Releaf::ActionController
Defined in:
app/lib/releaf/action_controller/search.rb

Instance Method Summary collapse

Instance Method Details

#search(text) ⇒ Object


12
13
14
15
16
17
# File 'app/lib/releaf/action_controller/search.rb', line 12

def search(text)
  return unless feature_available?(:search)
  return if text.blank?
  return if searchable_fields.blank?
  @collection = searcher_class.prepare(relation: @collection, fields: searchable_fields, text: text)
end

#searchable_fieldsObject


8
9
10
# File 'app/lib/releaf/action_controller/search.rb', line 8

def searchable_fields
  @searchable_fields ||= Releaf::DefaultSearchableFields.new(resource_class).find
end

#searcher_classObject


19
20
21
# File 'app/lib/releaf/action_controller/search.rb', line 19

def searcher_class
  Releaf::Search
end