Forum: Ruby on Rails Join table query question

Be2b7277cff8516117cbd7a33df7b03a?d=identicon&s=25 Dave Castellano (dcastellano1)
on 2013-08-15 20:53
Hi,

I created a join table and am having trouble figuring out how to query
it...

create_table "minisections_questions", :id => false, :force => true do
|t|
    t.integer "minisection_id"
    t.integer "question_id"
  end

I am trying to find all question id's with a specific minisection_id  eg
(params[:minisection_id])

@question_list = ???

ANy guidance would be helpful as I really am having trouble figuring
this out.

Thanks
Dave
622547b2f551885f92449b4924573242?d=identicon&s=25 John Davalos (Guest)
on 2013-08-15 21:06
(Received via mailing list)
could you do something like
Minisection.find(params[:minisection_id]).questions

@question_list = Minisection.find(params[:minisection_id]).questions
Be2b7277cff8516117cbd7a33df7b03a?d=identicon&s=25 Dave Castellano (dcastellano1)
on 2013-08-15 21:42
Dave Castellano wrote in post #1118800:
> Hi,
>
> I created a join table and am having trouble figuring out how to query
> it...
>


Thank you!

Dave
622547b2f551885f92449b4924573242?d=identicon&s=25 John Davalos (Guest)
on 2013-08-15 23:32
(Received via mailing list)
worked? if so, you're welcome!
Be2b7277cff8516117cbd7a33df7b03a?d=identicon&s=25 Dave Castellano (dcastellano1)
on 2013-08-16 03:29
John Davalos wrote in post #1118812:
> worked? if so, you're welcome!

Yep!  Worked well, and helped me understand the concept.  so thanks...
622547b2f551885f92449b4924573242?d=identicon&s=25 John Davalos (Guest)
on 2013-08-20 00:48
(Received via mailing list)
awesome! no problem.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.