Sha256: 695ca2844a9ed5c550eedbfac07a8a7fe74029f419c11fec9c4f363c361f2741

Contents?: true

Size: 536 Bytes

Versions: 43

Compression:

Stored size: 536 Bytes

Contents

module Releaf::ActionController::Search
  extend ActiveSupport::Concern

  included do
    helper_method :searchable_fields
  end

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

  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

  def searcher_class
    Releaf::Search
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
releaf-core-3.1.0 app/lib/releaf/action_controller/search.rb
releaf-core-3.0.3 app/lib/releaf/action_controller/search.rb
releaf-core-3.0.2 app/lib/releaf/action_controller/search.rb
releaf-core-3.0.1 app/lib/releaf/action_controller/search.rb
releaf-core-3.0.0 app/lib/releaf/action_controller/search.rb
releaf-core-2.2.1 app/lib/releaf/action_controller/search.rb
releaf-core-2.2.0 app/lib/releaf/action_controller/search.rb
releaf-core-2.1.2 app/lib/releaf/action_controller/search.rb
releaf-core-2.1.1 app/lib/releaf/action_controller/search.rb
releaf-core-2.1.0 app/lib/releaf/action_controller/search.rb
releaf-core-2.0.1 app/lib/releaf/action_controller/search.rb
releaf-core-2.0.0 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.22 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.21 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.20 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.19 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.18 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.17 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.16 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.15 app/lib/releaf/action_controller/search.rb