I am looking for a way to create , ( and this is the part I really do not know) a method a named_scope a something… that allows me to create an query where I can combine several columns from different tables. In plain sql I could create a view and work with it; but I like one of the concepts of named_scope that allows me to use it with other to form the query I want.
I wish I could do something like this: class Master < ActiveRecord::Base belongs_to :table1 belongs_to :table2 belongs_to :table3 named_scope :selected_fields, :select => "masters.col1, table1s.col3, talbe2s.col5" end I've tried few things using joins and include but it seems like it is always selecting the Master table only. My playing around had not payed off at all, I’ve tried using :include, :select , etc… Can someone please give me some advice and maybe a sample code. The documentation I've found is very simplistic. Thank you very much, -Luis. -- 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 -~----------~----~----~----~------~----~------~--~---

