Rails how to return a list of answers with a specific question_id
- by mytwocentsisworthtwocents
Let's say I have two Models, Answers and Questions (there are others, but irrelevant to the question). The models are as follows:
Answer.rb
class Answer < ActiveRecord::Base
attr_accessible :description, :question_id
has_one :question, :through => :user, :dependent => :destroy
validates :description, :presence => true
end
…