Module: Alchemy::SearchableResource
- Included in:
- BaseRecord
- Defined in:
- lib/alchemy/searchable_resource.rb
Overview
Defines the methods that are needed to make a model searchable in Alchemy’s admin search by Ransack.
Constant Summary collapse
- SEARCHABLE_COLUMN_TYPES =
%i[string text]
Instance Method Summary collapse
-
#ransackable_associations(_auth_object = nil) ⇒ Object
Allow all associations defined in
alchemy_resource_relations
to be searchable by Ransack. -
#ransackable_attributes(_auth_object = nil) ⇒ Object
Allow all string and text attributes to be searchable by Ransack.
-
#ransortable_attributes(_auth_object = nil) ⇒ Object
Allow all attributes to be sortable by Ransack.
Instance Method Details
#ransackable_associations(_auth_object = nil) ⇒ Object
Allow all associations defined in alchemy_resource_relations
to be searchable by Ransack.
20 21 22 |
# File 'lib/alchemy/searchable_resource.rb', line 20 def ransackable_associations(_auth_object = nil) searchable_alchemy_resource_associations end |
#ransackable_attributes(_auth_object = nil) ⇒ Object
Allow all string and text attributes to be searchable by Ransack.
10 11 12 |
# File 'lib/alchemy/searchable_resource.rb', line 10 def ransackable_attributes(_auth_object = nil) searchable_alchemy_resource_attributes end |
#ransortable_attributes(_auth_object = nil) ⇒ Object
Allow all attributes to be sortable by Ransack.
15 16 17 |
# File 'lib/alchemy/searchable_resource.rb', line 15 def ransortable_attributes(_auth_object = nil) columns.map(&:name) end |