andrew-KR6O7HwU5NFCpjqP0VxSwUEOCMrvLtNR@public.gmane.org
2006-Oct-20 06:04 UTC
how to display integer fields
How do I override Ruby''s default functionality of not displaying integer database fields? I have a database table that has a client_id field that contains an integer that corresponds to the clients table id field. The database does not have a foreign key set in place. The client_id field in the table I am searching is just and INT. When I do a find(:all) on the table, only the text/varchar fields are returned in the code. Obviously, I am a newbie to Ruby. I appreciate any down to earth help you can give me. I want the query I am doing to return the client_id field value so I can do some comparisons. Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
andrew-KR6O7HwU5NFCpjqP0VxSwUEOCMrvLtNR@public.gmane.org wrote:> How do I override Ruby''s default functionality of not displaying > integer database fields? I have a database table that has a client_id > field that contains an integer that corresponds to the clients table id > field. The database does not have a foreign key set in place. The > client_id field in the table I am searching is just and INT. When I do > a find(:all) on the table, only the text/varchar fields are returned in > the code.There''s no reason that it shouldn''t return that column, and you should be able to access it the same as any other attribute: your_object.client_id Does that work? Chris --~--~---------~--~----~------------~-------~--~----~ 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 Oct 20, 3:15 am, "Chris Mear" <c...-OIzkuoyqg0kAvxtiuMwx3w@public.gmane.org> wrote:> and...-KR6O7HwU5NFCpjqP0VxSwUEOCMrvLtNR@public.gmane.org wrote: > > How do I override Ruby''s default functionality of not displaying > > integer database fields? I have a database table that has a client_id > > field that contains an integer that corresponds to the clients table id > > field. The database does not have a foreign key set in place. The > > client_id field in the table I am searching is just and INT. When I do > > a find(:all) on the table, only the text/varchar fields are returned in > > the code.There''s no reason that it shouldn''t return that column, and you should > be able to access it the same as any other attribute: > > your_object.client_id > > Does that work? > > ChrisThe scaffold hides columns with the suffix ''_id'' by default. There are two solutions... 1. change the name so that it doesn''t contain ''_id'' 2. stop using the scaffold and put the appropriate calls in the views... _Kevin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---