[Rails] Re: Join query in rails

2009-04-10 Thread gundestrup
why don't you use the build options in the framework? specify the joins / relations in the model. Then do @user = User.find(params[:id]) (controller) View: <=% @user.contactinfo.telephone %> or <% for user in @users do |t| %> <%= t.contactinfo.telefone %> <%= t.contactinfo.fax %> If you cant to

[Rails] Re: Join query in rails

2009-04-10 Thread Newb Newb
Priya Buvan wrote: > > You can use :select option in the same query.. yes priya i used but i get error ...it gives me unknown column could you give the sample @contactinfo= ContactInfo.find(:all,:select => "userinfo.first_name,contactinfo.user_id", :joins => "contactinf inner join userinfo

[Rails] Re: Join query in rails

2009-04-10 Thread Priya Buvan
You can use :select option in the same query.. -- 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 rubyonrail

[Rails] Re: Join query in rails

2009-04-10 Thread Lakshmi Narayana
i think this is the way you should write like this... as i am also new to rails ContactInfo.find(:all, :join => user_info) On Thu, Apr 9, 2009 at 4:10 PM, Newb Newb wrote: > > Hi.. > how i should write the below query in rails.i found through mysql > tutorial.i m not pro in rails ..so give some

[Rails] Re: Join query in rails

2009-04-09 Thread Andrew Timberlake
On Thu, Apr 9, 2009 at 3:14 PM, Newb Newb wrote: > > Priya Buvan wrote: >> Newb Newb wrote: >>> Hi.. >>> how i should write the below query in rails.i found through mysql >>> tutorial.i m not pro in rails ..so give some lights >>> >>> SELECT * FROM contactinfo join userinfo on contactinfo.con

[Rails] Re: Join query in rails

2009-04-09 Thread Newb Newb
Priya Buvan wrote: > Newb Newb wrote: >> Hi.. >> how i should write the below query in rails.i found through mysql >> tutorial.i m not pro in rails ..so give some lights >> >> SELECT * FROM contactinfo join userinfo on contactinfo.contact_id = >> userinfo.id where contactinfo.user_id = 25 >>

[Rails] Re: Join query in rails

2009-04-09 Thread Priya Buvan
Newb Newb wrote: > Hi.. > how i should write the below query in rails.i found through mysql > tutorial.i m not pro in rails ..so give some lights > > SELECT * FROM contactinfo join userinfo on contactinfo.contact_id = > userinfo.id where contactinfo.user_id = 25 > > Thanks in advance @conta

[Rails] Re: Join query in rails

2009-04-09 Thread Andrew Timberlake
On Thu, Apr 9, 2009 at 12:40 PM, Newb Newb wrote: > > Hi.. > how i should write the below query in rails.i found through mysql > tutorial.i m not pro in rails ..so give some lights > > SELECT * FROM contactinfo join userinfo on contactinfo.contact_id = > userinfo.id where contactinfo.user_id