nkallen/arel — Issue #9: Arel::Visitors::Informix ignores joins
Author: jhollinger
Created: 2012-01-24 22:57:35+00:00
State: open

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.)