PFF Error on NEW OPTIONS FOR ASSOCIATIONS: :VALIDATE

1 view
Skip to first unread message

Thibaud Guillaume-Gentil

unread,
Oct 25, 2008, 6:36:46 AM10/25/08
to Envycasts Discussion
Hi,

There's an error on page 9 in the PDF. It's said that the new
association option :validate default is "false", but it's "true",
right?

Here the uncorrect text:
Although, in this prior example, I disabled validation to demonstrate
this new feature, in fact, the default setting for
:validatehas been set tofalsein Rails 2.2, so :validate => false would
not actually be necessary in the code
above. On the other hand, if you wished to keep the old behavior, it
would be necessary to use :validate => true.

There's also a litte typo in the title "NEW OPTIONS FOR
ASSOCATIONS: :VALIDATE" on associations on page 8.

Thibaud

Carlos Brando

unread,
Oct 30, 2008, 10:27:20 AM10/30/08
to Envycasts Discussion
Hi Thibaud,

I think not.
But I was in doubt, then I just do the test again and the default
value is false.

Initially the default value was true, but it was changed to false at
the end.

Cheers,
Carlos Brando


On 25 out, 08:36, Thibaud Guillaume-Gentil <guillaumegen...@gmail.com>
wrote:

Thibaud Guillaume-Gentil

unread,
Nov 6, 2008, 1:48:09 AM11/6/08
to Envycasts Discussion
Hi Carlos,

I went to look at the ActiveRecord Association module in edge here:
http://github.com/rails/rails/tree/master/activerecord/lib/active_record/associations.rb

And you right for the belongs_to (ligne 976) and has_one (ligne 862)
associations, :validate is +false+ by default.
BUT for the has_many (749) and has_many_and_belongs_to (ligne 1191)
associations, :validate is +true+ by default.

I made my test whit the has_many it's why I post this errata.

But I went to look at the Rails 2.1.2 and the validate option was
already here, so it's not a new feature of Rails 2.2. The behaviour
hasn't changed.

Cheers,
Thibaud Guillaume-Gentil
Reply all
Reply to author
Forward
0 new messages