I have the same problem. A query which was previously:

  macro_step = Step.find :first, :include => [ :parameters ],
    :conditions => [ "name = 'delegate_id' AND int_v = ?", macro.id ]

failed with the message

  ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'name' in 
'where clause': SELECT * FROM `step` WHERE (name = 'delegate_id' AND 
int_v = 92)  LIMIT 1

Because the delegate_id column is actually on the parameters table.

Rewriting the query as:

  macro_step = Step.find :first, :joins => [ :parameters ],
    :conditions => [ "name = 'delegate_id' AND int_v = ?", macro.id ]

worked for me in this case because the join did not need to be an OUTER 
JOIN. But this is clearly a Rails bug.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to