Skip to content
This repository

undefined method `relation' for #<Arel::Nodes::NamedFunction> #156

mickeb opened this Issue August 17, 2012 · 4 comments

2 participants

Mikael Björkman Ernie Miller
Mikael Björkman


After upgrading to Active Record 3.2.8 and Squeel 1.0.9 our specs fails with:

/Users/mikaelbjorkman/.rvm/gems/ruby-1.9.3-p125-perf/gems/activerecord-3.2.8/lib/active_record/relation/spawn_methods.rb:41:in block in merge': undefined methodrelation' for #Arel::Nodes::NamedFunction:0x007fbde1fa4b40 (NoMethodError)

I have written a bare bone reproduction:

From what I can tell, the equality operator seems to be the problem. Greater/Less than works.

Thanks for your hard work on this gem!

Best regards

Ernie Miller

Unfortunately, this is due to a bug/missing feature in Rails. I just checked and it fails across the board in 3.0.x - 3.2.x. Not sure how the spec was ever passing for you before now.

Mikael Björkman

Ok, I see.

I reverted back to the old version to double check.

bundle show rails => rails-3.2.5
bundle show squeel => squeel-0.9.5

Played around i the console and it does seem to work. However, let me get back to you on monday with at fresh mind and a extra set of eyes. Don't want to waste anybodys time.


Ernie Miller
Ernie Miller ernie referenced this issue from a commit in ernie/rails August 17, 2012
Ernie Miller Fix merge error when Equality LHS is non-attribute
This is at best a band-aid for a more proper fix, since it won't truly
handle the removal of the previous equality condition of these other
nodes. I'm planning to put in some work on ARel toward supporting that

Related: rails/arel#130, activerecord-hackery/squeel#153, activerecord-hackery/squeel#156
Mikael Björkman mickeb closed this August 20, 2012
Mikael Björkman

No further questions. Great to see a solution beeing worked on. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.