nkallen / arel

A Relational Algebra
268 stars 429 forks source link

Arel::Visitors::Informix ignores joins #9

Open jhollinger opened 12 years ago

jhollinger commented 12 years ago

I am using Arel v3.0 with Informix in ActiveRecord in Rails 3.2. A joined query like Comment.joins("inner join posts on post.id = comments.post_id").where("posts.published = 1") results in the invalid sql statement select * from comments where posts.published = 1.

It seems visit_Arel_Nodes_SelectCore in the Informix Visitor class is ignoring the joins. I was able to fix it with the following changes in lib/arel/visitors/informix.rb:

- ("FROM #{visit o.froms}" if o.froms),
+ ("FROM #{visit o.source}" if o.source),

Don't know if that's a "good" fix or not. If no one comments on this soon, I'll probably fork and submit a pull request.

(This problem was present in earlier versions of both Arel and Rails, but I don't how far back it goes.)

nicb commented 11 years ago

This solved my problem too! Thanks. Has there been any development to this since you posted this issue? I have checked your forked arel code and it does not seem to carry the mod you made for this issue.