On Tue, Aug 11, 2009 at 11:14 AM, Sijo Kg
<[email protected]>wrote:

>
> Hi  Karthik Kantharaj
>
> Ok One more thing please tell what you are trying to attain with the
> above query?
>
> Sijo
>

Hi sijo

With the below query

@getdata=Agency.all(:joins=>:contracts,
      :select=>"agencies.*",:conditions=>["agencies.status =?",1 ])

I want to access and retrieve the data from both tables

condition both table id should be equal

e.g agencies.id=contracts.id

In the below method

for getdata in @getdata do
  puts getdata.name
end

I am able to access agencies data but not contracts data
I need to know how to access contracts data

because i need to group them, one contract can have any number of agencies

contract1
    agency1
    agency2
contract2
   agency1
   agency2

I have explained you my exact requirement sijo, i am stuck in this i need
help

Thanks

-- 
Karthik.k
Mobile - +91-9894991640



>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to