Has many association with finder_sql

Hi, I have a customer and conversation model. A conversation is between 2 customers. Here is my association in customer. has_many :conversations, :class_name => "Conversation", :order => 'updated_at DESC', :finder_sql => 'SELECT * FROM conversations c WHERE (c.started_by = #{id} OR c.with = #{id})' do     def with(cust_id)      all(:conditions => ["conversations.started_by = ? OR conversations.with = ?", cust_id, cust_id])     end   end

Inside the association block I made a method which filters on the second customer of the conversation.

But when I do: myCustomer.conversations.with(someoneelseID)

I get the following error.

ActiveRecord::StatementInvalid (Mysql::Error: Operand should contain 1 column(s): SELECT * FROM `conversations` WHERE (conversations.started_by = 1 OR conversations.with = 1) AND (SELECT * FROM conversations c WHERE (c.started_by = 1 OR c.with = 1)) ORDER BY updated_at DESC)

How can i make Rails build a correct sql request? Greg

Greg Ma wrote in post #971151:

ActiveRecord::StatementInvalid (Mysql::Error: Operand should contain 1 column(s): SELECT * FROM `conversations` WHERE (conversations.started_by = 1 OR conversations.with = 1) AND (SELECT * FROM conversations c WHERE (c.started_by = 1 OR c.with = 1)) ORDER BY updated_at DESC)

Are you sure you really need :finder_sql? I didn't see anything here that :condtions and :order couldn't handle.