Class: Plutonium::Query::Base

Inherits:
Object
  • Object
show all
Includes:
Definition::ConfigAttr, Definition::DefineableProps, Definition::Presentable
Defined in:
lib/plutonium/query/base.rb

Direct Known Subclasses

AdhocBlock, Filter, ModelScope

Instance Method Summary collapse

Methods included from Definition::Presentable

#description, #icon, #label

Instance Method Details

#apply(scope, **params) ⇒ Object

Applies a parameterized query to modify the given scope.

Examples:

Basic usage

query.apply(User.all, status: 'active')

Parameters:

  • scope (Object)

    The initial scope that will be filtered, sorted, or otherwise modified by applying this query. This is typically an ActiveRecord::Relation or similar query object.

  • params (Hash)

    Optional parameters that configure how the query is applied. The specific parameters accepted depend on the implementing class.

Returns:

  • (Object)

    The modified scope with this query’s conditions applied. Returns the same type as the input scope parameter.

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/plutonium/query/base.rb', line 24

def apply(scope, **params)
  raise NotImplementedError, "#{self.class}#apply(scope, **params)"
end