6
是否可以指定參數:連接與條件類似?rails - :加入清理/替換
這裏有一個例子(SQL代碼無關)
named_scope :threads, {
:joins => [" LEFT JOIN groups_messages gm ON messages.id=gm.message_id AND gm.group_id IN (?) ",@group_ids_array],
:conditions => ["creator_id=? AND messages.id IN (?)", current_user_id, @message_ids_array]
}
在這個例子參數
:條件將得到正確插入,但:聯接我會得到一個錯誤
Association named ' LEFT JOIN groups_messages gm ON messages.id=gm.message_id and gm.group_id IN (?) ' was not found; perhaps you misspelled it?
什麼函數替代參數:條件?
非常感謝你!我被困在那裏大約一天 – 2009-10-06 11:07:00