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
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
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
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
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
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
>>
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
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
8 matches
Mail list logo