Tim Uckun
2008-Feb-07 22:32 UTC
Automatically populating models with the defaults from the table definition.
I am using SQL server with ODBC adapter. If I have a field defined as
"hair_color string(255) default("UNK"), not null" it
causes
problems with saving the record if I don''t specify the hair color.
In this case if I don''t specify a hair color AR puts a NULL into the
insert clause and SQL server pukes. If AR simply had left that field
out of the insert everything would have been fine.
Is there a way to tell AR to either leave the NULL fields out of the
insert (or update) or to load the defaults into the model when it''s
created?
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?hl=en
-~----------~----~----~----~------~----~------~--~---