The following error is produced in Arel when an aggregation is provided as the :scope parameter to validates_uniqueness_of:
TypeError: Cannot visit CustomClassWithoutRecognizedAncestors
from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:25:in `rescue in visit'
from /usr/local/Cellar/ruby/1.9.3-p125/lib/ruby/gems/1.9.1/gems/arel-3.0.2/lib/arel/visitors/visitor.rb:19:in `visit'
ActiveRecord uses the aggregation's value object as the scope value instead of its actual attribute value.
The attached code resolves this issue by using the attribute value after type cast but before conversion.
use read_attribute to allow scoping by an aggregation's attribute val…
…ue instead of its converted value object
Is this still an issue?
Closing this since #6743 was merged.