Module: Recourse::Recoursive
- Defined in:
- lib/recourse/recoursive.rb
Overview
Ensures every Active Record object is compatible with recourse.
Instance Method Summary collapse
-
#recourse_cachable? ⇒ Boolean
Return whether the content to display all the models can be cached.
-
#recourse_includes ⇒ Object
Return the associations to .include when loading all the resources.
-
#recourse_order ⇒ Object
Return the fields to .order when loading all the models.
-
#recourse_searchable? ⇒ Boolean
Whether Ransack search attributes are defined on the resource.
-
#recourse_sortable? ⇒ Boolean
Whether Ransack sort attributes are defined on the resource.
Instance Method Details
#recourse_cachable? ⇒ Boolean
Return whether the content to display all the models can be cached.
15 16 17 |
# File 'lib/recourse/recoursive.rb', line 15 def recourse_cachable? true end |
#recourse_includes ⇒ Object
Return the associations to .include when loading all the resources.
6 7 8 |
# File 'lib/recourse/recoursive.rb', line 6 def recourse_includes %i[] end |
#recourse_order ⇒ Object
Return the fields to .order when loading all the models.
11 12 |
# File 'lib/recourse/recoursive.rb', line 11 def recourse_order end |
#recourse_searchable? ⇒ Boolean
Returns whether Ransack search attributes are defined on the resource.
20 21 22 |
# File 'lib/recourse/recoursive.rb', line 20 def recourse_searchable? ransackable_attributes.any? || ransackable_associations.any? end |
#recourse_sortable? ⇒ Boolean
Returns whether Ransack sort attributes are defined on the resource.
25 26 27 |
# File 'lib/recourse/recoursive.rb', line 25 def recourse_sortable? ransortable_attributes.any? end |