module DataMapper::Aggregates::Query
Public Class Methods
included(base)
click to toggle source
# File lib/dm-aggregates/query.rb, line 4 def self.included(base) base.class_eval " # FIXME: figure out a cleaner approach than AMC alias_method :assert_valid_fields_without_operator, :assert_valid_fields alias_method :assert_valid_fields, :assert_valid_fields_with_operator ", __FILE__, __LINE__ + 1 end
Public Instance Methods
assert_valid_fields_with_operator(fields, unique)
click to toggle source
# File lib/dm-aggregates/query.rb, line 12 def assert_valid_fields_with_operator(fields, unique) operators, fields = fields.partition { |f| f.kind_of?(DataMapper::Query::Operator) } operators.each do |operator| target = operator.target unless target == :all || @properties.include?(target) raise ArgumentError, "+options[:fields]+ entry #{target.inspect} does not map to a property in #{model}" end end assert_valid_fields_without_operator(fields, unique) end