filter search breaks when searching on a has_one :through field

3 views
Skip to first unread message

bret...@gmail.com

unread,
Jan 20, 2009, 3:07:12 PM1/20/09
to Streamlined
When I search in the default filter box, i get a mysql error:

Mysql::Error: Unknown column 'builds.build_id' in 'on clause': SELECT
count(DISTINCT `smokes`.id) AS count_all FROM `smokes` LEFT OUTER
JOIN `builds` ON (`smokes`.`id` = `builds`.`build_id`) LEFT OUTER
JOIN `products` ON (`products`.`id` = `builds`.`product_id`) LEFT
OUTER JOIN `builds` builds_smokes ON `builds_smokes`.id =
`smokes`.build_id WHERE (smokes.id LIKE '%b%' OR products.name LIKE '%b
%' OR builds.name LIKE '%b%' OR smokes.notes LIKE '%b%' OR
smokes.result LIKE '%b%')

The problem is in the JOIN statements, it has the id fields on the
wrong side of the equation, instead of smokes.id = builds.build_id it
should be smokes.build_id = build.id. Any ideas on what could be
causing this? I'm rather certain my models' relationships are setup
correctly. Any insight would be appreciated.

bret...@gmail.com

unread,
Feb 9, 2009, 4:08:18 PM2/9/09
to Streamlined
any ideas on this one?

bret...@gmail.com

unread,
Feb 12, 2009, 1:37:52 PM2/12/09
to Streamlined
I found a solution. Django.
Reply all
Reply to author
Forward
0 new messages