Module: ActiveElement::Components::TextSearch

Defined in:
lib/active_element/components/text_search.rb,
lib/active_element/components/text_search/sql.rb,
lib/active_element/components/text_search/component.rb,
lib/active_element/components/text_search/authorization.rb

Overview

Provides back end for live text search components.

Defined Under Namespace

Classes: Authorization, Component, Sql

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.authorized_text_searchesObject (readonly)

Returns the value of attribute authorized_text_searches.



15
16
17
# File 'lib/active_element/components/text_search.rb', line 15

def authorized_text_searches
  @authorized_text_searches
end

Class Method Details

.register_authorized_text_search(model:, with:, providing:) ⇒ Object



17
18
19
# File 'lib/active_element/components/text_search.rb', line 17

def register_authorized_text_search(model:, with:, providing:)
  authorized_text_searches << [model, with, providing]
end

.text_search_options(model:, with:, providing:) ⇒ Object



21
22
23
24
25
26
# File 'lib/active_element/components/text_search.rb', line 21

def text_search_options(model:, with:, providing:)
  {
    search: { model: model.name.underscore, with: with, providing: providing },
    placeholder: "Search for #{model.name.titleize} by #{humanized_names(with).join(', ')}..."
  }
end