Hi,
I'm stuck trying to figure out how to do a query to find all the
questions in a selected subject only.
My associations:
class Subject < ActiveRecord::Base
has_many :books
has_many :questions
has_many :chapters, :through => :books
has_many :sections, :through => :chapters
has_many :subsections, :through => :sections
has_many :minisections, :through => :subsections
class Question < ActiveRecord::Base
has_and_belongs_to_many :minisections
The query:
@question_list = Question.where(all the questions associated with the
subject through the above associations???)
Any suggestions where to start would be appreciated.
Thanks,
Dave
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/950a42f1a9d759e122ee7c6ebbfe553d%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment