karthik_k
(karthik k)
August 11, 2009, 4:29am
1
hi
I have a controller
def showagencies
@getdata=Agency.all(:joins=>:contracts,
:select=>“agencies.*”,:conditions=>[“contract_id in (?) and agencies.status =?”,contracts.id ,1 ])
end
@getdata is not visible in html its lenght is o but has some contents
plz let me know how to access this
karthik_k
(karthik k)
August 11, 2009, 4:52am
2
Thank you
i made small mistake
but i got the output
karthik_k
(karthik k)
August 11, 2009, 5:02am
3
Hi i have another doubt
for the below code
def showagencies
@contracts=Contract.find(:all,:conditions=>[‘status=?’,1])
for contract in @contracts do
@agency=Agency.all(:joins=>:contracts,
:select=>“agencies.*”,:conditions=>[“contract_id in (?) and agencies.status =?”,contract.id ,1 ])
@contract_name=[contract.name](http://contract.name)
for getdata in @getdata do
@agency_name=[getdata.name](http://getdata.name)
end
end
end
now as you can see @contract_name will have many agencies
so i have another for loop and getting @agency_name
so my out put will be
e.g
contract1
agency1
agency2
contract2
agency1
agency2
now can i take @contract_name and @agency_name
and display like the above output in html
if my approach is wrong plz guide me