Symbol in hash is not converted to Arel::Attribute #41

stephenprater opened this Issue Sep 26, 2011 · 0 comments


None yet

1 participant


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)

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
2 /Volumes/Sites/meta_where/lib/meta_where/visitors/visitor.rb:43
3 /Volumes/Sites/meta_where/lib/meta_where/visitors/visitor.rb:29
4 /Volumes/Sites/meta_where/lib/meta_where/relation.rb:257
5 /Volumes/Sites/meta_where/lib/meta_where/relation.rb:157
6 /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-3.0.10/lib/active_record/relation/query_methods.rb:149
7 /opt/local/lib/ruby1.9/gems/1.9.1/gems/activerecord-3.0.10/lib/active_record/relation.rb:321
8 /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands/runner.rb:4
9 /opt/local/lib/ruby1.9/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands.rb:48
10 /Volumes/Sites/agrport/script/rails:39
11 /Volumes/Sites/agrport/script/rails:6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment