Forum: Ruby on Rails search across models

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E38118c6d20b4544e424fd700571e090?d=identicon&s=25 srikanth (Guest)
on 2009-03-18 13:34
(Received via mailing list)
Hi all,
I am trying to implement the search across models.
But i could not able to do this.

let me tell you my application details:

i have tables like:

1)containerformats :
contains the streamnames

2)transportstreams :
have how many programs are there in each stream of
containerformattable
and has containerformat_id as one column

3)programs:
have how many video and audio streams are there in each program
and has  transportstream_id as one column

4)streams :
which will have the video and audio stream parametes
and it has all other table ids like:
transportstream_id
containerformat_id
program_id

and i have association like:

containerformats has_many:transportstreams
transportstreams has_many:programs
programs has_many:streams
streams belongs_to :all above tables

I have cretaed a search controller to implement the search:
now here my sample querie i want to implement in my search controller.

find streams from containerformats has number of programs = 1(which is
from transportstreams table) and nummberof videos =1 (which is from
programs table) and resolution ="720x480"(which is from streams table)

the above query i could able to write and  test in mysql prompt.
But if i try to implement this i could not able to do this.
Can you suggest me how exactly the code looks like to search the data
from a table based on other table parametrs selected?

suggest me if iam doing any mistake while assigning associatioons.

Any help would be appreciated.

thanks
Srikanth
This topic is locked and can not be replied to.