gaurav bagga wrote:> hi all, > > if i want to write a query select * from a,b where a.b_id=b.id in > active > record > using joins,condition how can i write that > > in docs i found for conditions you do by giving "?" and then the > parameter > eg. a.b_id=? > but it takes b.id as string i.e a.b_id=''b.id'' > i dont want that > > any suggestions > > thanks in advance > > regards > gauravYou create a ''a'' model, a ''b'' model and then you add a belongs_to b in your model definition -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
hi, i have that in my model files regards gaurav On 10/6/06, nuno <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > gaurav bagga wrote: > > hi all, > > > > if i want to write a query select * from a,b where a.b_id=b.id in > > active > > record > > using joins,condition how can i write that > >> in docs i found for conditions you do by giving "?" and then the> > parameter > > eg. a.b_id=? > > but it takes b.id as string i.e a.b_id=''b.id'' > > i dont want that > > > > any suggestions > > > > thanks in advance > > > > regards > > gaurav > > You create a ''a'' model, a ''b'' model > and then > you add a belongs_to b in your model definition > > > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
hi all, if i want to write a query select * from a,b where a.b_id=b.id in active record using joins,condition how can i write that in docs i found for conditions you do by giving "?" and then the parameter eg. a.b_id=? but it takes b.id as string i.e a.b_id=''b.id'' i dont want that any suggestions thanks in advance regards gaurav -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20061006/bccc813f/attachment.html