Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


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

mickeb opened this Issue · 4 comments

2 participants



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


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.


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 ernie referenced this issue from a commit in ernie/rails
@ernie ernie 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

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

@mickeb mickeb closed this
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.