Hi there, I''m new to Rails and having some fun writing a small application to keep track of our server details. I''m using PostgreSQL with it''s built-in data types for Ethernet card MAC addresses (pgsql type: macaddr), and server IP addresses (pgsql type: inet). Rails scaffolding doesn''t know what to do with these types when I view the scaffolding edit page, which isn''t surprising because they are probably not so widely used. Can anybody tell me how I can add these types to Active Record, or is this not part of Active Record, but more to do with rendering in the Action Pack view? Do I need to tell the view that an IP address input can be rendered as 4 short form input boxes, for example? Thanks, -- Scott
Hi! On Sun, 13 Feb 2005, Scott Lowe wrote the following:> Can anybody tell me how I can add these types to Active > Record, or is this not part of Active Record, but more to > do with rendering in the Action Pack view? Do I need to > tell the view that an IP address input can be rendered > as 4 short form input boxes, for example? >I''m rather new to RoR too, but I think you should take a look at the ActionView::Helpers::FormHelper documentation here: http://api.rubyonrails.com/ bye Wolfgang
Wolfgang Klinger wrote:> Hi! > > On Sun, 13 Feb 2005, Scott Lowe wrote the following: > >>Can anybody tell me how I can add these types to Active >>Record, or is this not part of Active Record, but more to >>do with rendering in the Action Pack view? Do I need to >>tell the view that an IP address input can be rendered >>as 4 short form input boxes, for example? >> > > > I''m rather new to RoR too, > but I think you should take a look at the > ActionView::Helpers::FormHelper documentation here: > http://api.rubyonrails.com/ > > > bye > WolfgangHi Wolfgang, Thanks for replying so quickly :o) You are right, I can see where the interface elements are generated in actionpack/lib/action_view/helpers/form_helper.rb. Now I''m wondering how they are mapped to database types. I realise that I have a lot more reading to do, but you have got me off to a good start! -- Scott
Have a look into the database adapter. It basically just queries the schema and figures out the type by regexp. On Sun, 13 Feb 2005 15:39:49 +0000, Scott Lowe <scott-m0GYeLKb1GBWk0Htik3J/w@public.gmane.org> wrote:> Wolfgang Klinger wrote: > > Hi! > > > > On Sun, 13 Feb 2005, Scott Lowe wrote the following: > > > >>Can anybody tell me how I can add these types to Active > >>Record, or is this not part of Active Record, but more to > >>do with rendering in the Action Pack view? Do I need to > >>tell the view that an IP address input can be rendered > >>as 4 short form input boxes, for example? > >> > > > > > > I''m rather new to RoR too, > > but I think you should take a look at the > > ActionView::Helpers::FormHelper documentation here: > > http://api.rubyonrails.com/ > > > > > > bye > > Wolfgang > Hi Wolfgang, > > Thanks for replying so quickly :o) > > You are right, I can see where the interface elements > are generated in actionpack/lib/action_view/helpers/form_helper.rb. > > Now I''m wondering how they are mapped to database types. > I realise that I have a lot more reading to do, but > you have got me off to a good start! > > -- Scott > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://www.hieraki.org - Open source book authoring http://blog.leetsoft.com - Technical weblog