module ParamsReady::Query::Predicate::HavingAttribute

Public Instance Methods

context_for_predicates(context) click to toggle source
# File lib/params_ready/query/predicate.rb, line 113
def context_for_predicates(context)
  # We consider a an attribute having parameter atomic
  # so it's permitted per se including its contents
  context.permit_all
end
test(record) click to toggle source
# File lib/params_ready/query/predicate.rb, line 119
def test(record)
  return nil unless is_definite?

  attribute_name = definition.attribute_name
  record = dig(record, definition.associations)

  perform_test(record, attribute_name)
end
to_query(arel_table, context: Restriction.blanket_permission) click to toggle source
# File lib/params_ready/query/predicate.rb, line 107
def to_query(arel_table, context: Restriction.blanket_permission)
  table = definition.arel_table || arel_table
  select_expression = build_select_expression(table, context)
  build_query(select_expression, context: context)
end