回答と質問の2つのモデルがあります。質問にはhas_many応答があるため、各応答はquestion_idに関連付けられます。オブジェクト@responsesの応答に対応する質問を照会したいのですが、構文がわかりません。
@reponses = Response.find([1, 10])
@questions = Question.where(:id => [???])
私の最初の考えはこのようなものでしたが、この構文は間違っています:
@reponses = Response.find([1, 10])
@questions = Question.where(:id => @responses.question_id)