Method: Graphiti::Scoping::Base#apply

Defined in:
lib/graphiti/scoping/base.rb

#applyObject

Apply this scoping criteria. This is where we would chain on pagination, sorting, etc.

If #apply? returns false, does nothing. Otherwise will apply the default logic:

# no block, run default logic via adapter
allow_filter :name

Or the customized proc:

allow_filter :name do |scope, value|
  scope.where("upper(name) = ?", value.upcase)
end

Returns:

  • the scope object

See Also:



50
51
52
53
54
55
56
# File 'lib/graphiti/scoping/base.rb', line 50

def apply
  if apply?
    apply_standard_or_override
  else
    @scope
  end
end