About joinTable



Table1: name_table

id name
1 name1
2 name2

Table2: address_table

id address
1 address1
2 address2

jointable : name_address

name_id address_id
1 1
2 2

i dont know how to get all details , as i very new to this ruby on rails
whether to access name_address table to get all details

My output should be

name1 address1
name2 address2

please guide me

Hi Sijo

thank you

I will explain the real need

Table 1: agencie

id name description
1 agency1 desc1
2 agency2 desc2

Table 2: contract

id name description

1 contract1 desc1

2 contract2 desc2

Table 3 : agency_contracts

agency_id contract_id
1 1
2 1
1 2
2 2

So form the above table you can find one contract can contain any number or gagencies

so i need to display as


I think you can under stand inside one contract two agency comes in as it is in agency_contracts table

I need to write a ror format query and not in sql query(As my client needs)

this is what i need sijo

plz help

hi Blade

thank you

I have explained my exact requirement in my previous mail

I need a query which will take data from join table and display

though i dont know about that but saw in blog like


@agencies=Agenci.all(:joins …)

though i dont know this

Please guide me

Hi Sniper

Thank you