Class: Carbonyte::Finders::ApplicationFinder

Inherits:
ApplicationInteractor show all
Defined in:
app/interactors/carbonyte/finders/application_finder.rb

Overview

Carbonyte base class for all finders interactors. Finders are used to build queries based on parameters

Constant Summary collapse

DEFAULT_LIMIT =

Default limit for pagination

25

Instance Method Summary collapse

Methods inherited from ApplicationInteractor

inherited

Instance Method Details

#callObject

Starts building the query (:scope)

Parameters:

  • context:params (Hash)

    a customizable set of options

  • context:params:include (Hash)

    a customizable set of options

  • context:params:sort (Hash)

    a customizable set of options

  • context:params:limit (Hash)

    a customizable set of options

  • context:params:page (Hash)

    a customizable set of options



22
23
24
25
26
# File 'app/interactors/carbonyte/finders/application_finder.rb', line 22

def call
  include_relations if context.params[:include].present?
  sort if context.params[:sort].present?
  paginate
end

#can_include?(_rel) ⇒ Boolean

Returns true if the provided relation can be included

Parameters:

  • _rel (Symbol)

    the relation to include

Returns:

  • (Boolean)


30
31
32
# File 'app/interactors/carbonyte/finders/application_finder.rb', line 30

def can_include?(_rel)
  false
end