ActiveRecord, Mysql, NULL columns and uniqueness

Hi all.
Mysql allows to set multiple NULLs on columns with unique constraint,
it’s normal SQL. Well, but when I try to submit some form, all
unspecified values will be consodered as ‘’ (empty string) and
(Mysql::Error: Duplicate entry occurs (((. How I can teach ActiveRecord
to consider empty fields as NULL?

On 5-aug-2006, at 5:02, zven wrote:

Hi all.
Mysql allows to set multiple NULLs on columns with unique constraint,
it’s normal SQL. Well, but when I try to submit some form, all
unspecified values will be consodered as ‘’ (empty string) and
(Mysql::Error: Duplicate entry occurs (((. How I can teach
ActiveRecord
to consider empty fields as NULL?
It has not that much to do with SQL than with ActiveRecord, which
doesn’t coerce empty strings to nil. Try this:
textdriven.com - textdriven Resources and Information.


Julian ‘Julik’ Tarkhanov
please send all personal mail to
me at julik.nl