Module: Recourse::Searchable

Defined in:
lib/recourse/searchable.rb

Overview

Extends any model to be searchable with Ransack.

Instance Method Summary collapse

Instance Method Details

#filter_choicesObject

Note:

to be overriden by subclasses – the values for the field to filter by.



37
38
# File 'lib/recourse/searchable.rb', line 37

def filter_choices
end

#filter_fieldObject

Note:

to be overriden by subclasses – the name of the field to filter by.



29
30
# File 'lib/recourse/searchable.rb', line 29

def filter_field
end

#filter_promptObject

Note:

to be overriden by subclasses – the prompt for the field to filter by.



33
34
# File 'lib/recourse/searchable.rb', line 33

def filter_prompt
end

#ransackable_associations(auth_object = nil) ⇒ Object

Returns the associations that can be searched (by default: none).



11
12
13
# File 'lib/recourse/searchable.rb', line 11

def ransackable_associations(auth_object = nil)
  %w[ ]
end

#ransackable_attributes(auth_object = nil) ⇒ Object

Returns the attributes that can be searched.



6
7
8
# File 'lib/recourse/searchable.rb', line 6

def ransackable_attributes(auth_object = nil)
  %w[ ]
end

#ransortable_attributes(auth_object = nil) ⇒ Object

Returns the associations that can be sorted by (by default: none).



16
17
18
# File 'lib/recourse/searchable.rb', line 16

def ransortable_attributes(auth_object = nil)
  %w[ ]
end

#search_fieldObject

Note:

to be overriden by subclasses – the name of the field to search with.



21
22
# File 'lib/recourse/searchable.rb', line 21

def search_field
end

#search_promptObject

Note:

to be overriden by subclasses – the placeholder for the field to search with.



25
26
# File 'lib/recourse/searchable.rb', line 25

def search_prompt
end