[Rails] Validation not working with << on collection ?

Jeremy Kemper jeremy at bitsweat.net
Sat Dec 4 20:19:45 GMT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michel Rasschaert wrote:
> Here is my problem : Sometimes validation is ignored

What other times is validation ignored?


> notably when using << on a has_many collection. see the example.

See Ticket #185:
  http://dev.rubyonrails.org/trac.cgi/ticket/185

I think << should only associate records, not silently create new ones
or save/validate content fields.

has_many << updates the associate record's foreign key and
has_and_belongs_to_many << inserts a row in the join table.  Neither
touches the associate record's content; hence, neither requires full
save/validation.

jeremy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBshvhAQHALep9HFYRAlNrAKC/kMQkVMykUdA1n+5LBjFoivPC1ACg3tK+
1enl9ydqsumdssWVht+0sCo=
=my7b
-----END PGP SIGNATURE-----


More information about the Rails mailing list