Module: Recourse::Recoursive

Defined in:
lib/recourse/recoursive.rb

Overview

Ensures every Active Record object is compatible with recourse.

Instance Method Summary collapse

Instance Method Details

#recourse_cachable?Boolean

Return whether the content to display all the models can be cached.

Returns:

  • (Boolean)


15
16
17
# File 'lib/recourse/recoursive.rb', line 15

def recourse_cachable?
  true
end

#recourse_includesObject

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_orderObject

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.

Returns:

  • (Boolean)

    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.

Returns:

  • (Boolean)

    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