class ParamsReady::Query::PolymorphPredicate
Public Class Methods
new(definition, **_)
click to toggle source
Calls superclass method
ParamsReady::Parameter::AbstractParameter::new
# File lib/params_ready/query/polymorph_predicate.rb, line 15 def initialize(definition, **_) super definition @data = definition.polymorph_parameter.create end
Public Instance Methods
test(record)
click to toggle source
# File lib/params_ready/query/polymorph_predicate.rb, line 24 def test(record) return nil unless is_definite? data[data.type].test(record) end
to_query(arel_table, context: Restriction.blanket_permission)
click to toggle source
# File lib/params_ready/query/polymorph_predicate.rb, line 20 def to_query(arel_table, context: Restriction.blanket_permission) data[data.type].to_query_if_eligible(arel_table, context: context) end