I am currently suffering through integrating my beautiful rails app with an old legacy MS SQL based application. Lets just say that the database the old app used is not in any way normalized. So, in my case, I am reading data from the legacy app only -- I am not making any changes. The problem is, each table has 60 columns in it but in my model I only actually use and care about 5-10 of them. Retrieving all 60 columns is very slow, so I am trying to get my model to ignore the columns that I don''t use. Any guidance on how to accomplish this? For example, if I have a db table called Orgs: OrgID OrgName Address Address2 CreationDate Notes ContractStatus ... However, in my Org class, I would like to only have attributes for OrgID and OrgName. Is there anyway to accomplish this? Thanks for the assistance, gnubbs --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 2006-09-20, at 18:26 , gnubbs wrote:> but in my model I only actually use and care about 5-10 of them. > Retrieving all 60 columns is very slow, so I am trying to get my model > to ignore the columns that I don''t use.Model.find :select => "fieldnames" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Awesome. Exactly what I was looking for. Thank you very much. Caio Chassot wrote:> Model.find :select => "fieldnames"--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Sweet. I was not aware of this and had been using find_by_sql to achieve the same results. Thanks Caio On 9/20/06, gnubbs <gnubbs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Awesome. Exactly what I was looking for. Thank you very much. > > > Caio Chassot wrote: > > Model.find :select => "fieldnames" > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---