This may just be me being dense, but I'm having trouble getting Metawhere to look at other column values in the same row during a comparison. I'm using 1.0.4
The query I am running is ParentChildRelationship.where(:parent_id => :child_id)
ParentChildRelationship.where(:parent_id => :child_id)
The generated SQL is:
SELECT "parent_child_relationships".* FROM "parent_child_relationships" WHERE "parent_child_relationships"."parent_id" = 'child_id'
I expect to get something like
SELECT "parent_child_relationships".* FROM "parent_child_relationships" WHERE "parent_child_relationships"."parent_id" = "parent_child_relatinoships"."child_id"
I believe the problem lies in the Hash predicate visitor function, specifically in that the "value" side of the hash never appears to be converted into a Arel::Attribute. This is a reasonably clean rails app, in that the only additional gems activated are meta_where, jquery and sqlite3 are enabled.
predicates = [
@left = Arel::Atribute::Integer #<struct ... >
@right = :child_id
1 Current /Volumes/Sites/meta_where/lib/meta_where/visitors/predicate.rb:54