[Rails] unique boolean flag

Rodrigo Alvarez Fernández papipo at gmail.com
Tue Aug 29 10:57:53 GMT 2006


Hi!

I have a field "default", and i wish to validate that only one of the
records is true, the remaining must be false.
If there are no records, the first one created must be default=true.
Apart from that, when any new/updated record is set to default=true, the
remaining ones must be default=false.

How do you accomplish this?

Thanks in advance,
Rodrigo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060829/adcd42fa/attachment.html


More information about the Rails mailing list