clanlaw wrote:
> Why do you wish to do this?  If it is for efficiency then are you sure
> you need it?  You know that if you have a Master object @master then
> you can say @master.col1, @master.table1.col3 and @master.table2.col5.
> If in the find for @master you :include table1 and table2 it will do
> it all in one query.
> 
> Colin

The reasoning behind is that am going to to be using the console for 
this application not html, and it will be nice if I can make the users 
life more simple.
Later, I will be building the web interface, but for now all we need are 
statistics.

In any case I will like to know how to do it to satisfy my curiosity.

When I use include I get :
Mysql::Error: Unknown column 'table1s.col3' in 'field list':...

Then I tried :joints, and joints does not complain but the returned 
values only include masters columns and non of the table-ns.

for instance:

named_scope :selected_fields, :joins=>:table1, :select =>"masters.id, 
masters.col1, table1s.col22"

then at the console
Master.selected_fields

1,col1-content
and Iam expecting
1,col1-content,col22-content

If this is a bug, I am such a beginner to know the difference between my 
mistake or rails bugs.

Thanks
-- 
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