Doubt in retrieving data to html?

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
Mobile - +91-9894991640

Karthik Kantharaj wrote:
[…]

@getdata is not visible in html its lenght is o but has some contents

Looks like @getdata contains an array. (And by the way, that’s a
terrible variable name – use something more descriptive.)

plz let me know how to access this

Iterate over the @getdata array and generate appropriate HTML for each
element.


Karthik.k
Mobile - +91-9894991640

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Tue, Aug 11, 2009 at 10:18 AM, Marnen Laibow-Koser <
[email protected]> wrote:

Iterate over the @getdata array and generate appropriate HTML for each
element…

Thank you
i made small mistake
but i got the output


Karthik.k
Mobile - +91-9894991640

On Tue, Aug 11, 2009 at 10:22 AM, karthik k [email protected]
wrote:

Looks like @getdata contains an array. (And by the way, that’s a
i made small mistake
but i got the output


Karthik.k
Mobile - +91-9894991640

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 http://contracts.id/,1 ])

  @contract_name=contract.name

  for getdata in @getdata  do

    @agency_name=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


Karthik.k
Mobile - +91-9894991640