ernie/squeel — Issue #74: where clause with associations is broken
Author: panthomakos
Created: 2011-11-07 19:02:23+00:00
State: open

In MetaWhere it was possible to do the following:

Post.where(user: User.first).to_sql
=> "SELECT posts.* FROM posts WHERE posts.user_id = 1"

In Squeel this produces:

Post.where(user: User.first).to_sql
=> "SELECT posts.* FROM posts WHERE posts.user = 1"

Which causes a MySql Error:

Mysql2::Error: Unknown column 'posts.user' in 'where clause':