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-1.1.14 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.13 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.12 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.11 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.10 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.9 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.8 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.7 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.6 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.5 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.4 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.3 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.2 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.1 app/lib/releaf/action_controller/search.rb
releaf-core-1.1.0 app/lib/releaf/action_controller/search.rb
releaf-core-1.0.10 app/lib/releaf/action_controller/search.rb
releaf-core-1.0.9 app/lib/releaf/action_controller/search.rb
releaf-core-1.0.8 app/lib/releaf/action_controller/search.rb
releaf-core-1.0.7 app/lib/releaf/action_controller/search.rb
releaf-core-1.0.6 app/lib/releaf/action_controller/search.rb