モデルとその子References
を結合する次のメソッドを作成しました。Sections
def combined_references
ids = []
ids << self.id
self.children.each do |child|
ids << child.id
end
Reference.where("section_id = ?", ids)
end
ただしsection.combined_references
、次のエラーが返されます。
Mysql2::Error: Operand should contain 1 column(s): SELECT `references`.* FROM `references` WHERE (section_id = 3,4)
ID の正しい値が収集されたようですが、クエリの構造が間違っていますか?