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