On 29 March 2010 12:13, Nipuna Weerasinghe <[email protected]> wrote: > Hi Colin, > > Thank you very much for your quick reply. I'm just sitting in front of > the computer and thinking what to do , because I'm new to ruby and > rails. > > here is the explanation. > > x has zero or more records in the y table. and y belongs to x. > hope this will help.x table id is name y table id is Itname. but both > are reprecenting the same data.
I think maybe you need get some basic rails knowledge. I suggest you have a look at the rails guides at http://guides.rubyonrails.org/, Start with Getting Started (obviously). To help with your problem then look at ActiveRecord relationships. Then look through the others. It is not that I do not want to answer your question directly, but I think that you have some fundamental ideas wrong which would be sorted by working through the guides. Colin > > Colin Law wrote: >> On 29 March 2010 11:33, Nipuna Weerasinghe <[email protected]> wrote: >>> Hi, >>> >>> I have a controllers called x and y. I want to search and display "y" >>> tables data using X's primary key, this key is a foreign key for Y. >> >> That does not make sense to me unless you mean that the id field in xs >> table is the same as the id field in ys table. In that case why not >> just combine the tables? >> >> Probably I do not understand exactly what you mean. Is so please give >> the relationships between the models (has_many, belongs to etc) >> >> Colin > > -- > 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. > > -- 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.

