The validation is not "called".

a line like the following:

validates_numericality_of :whatever

is positioned directly in the class, not inside a class method.
therefore, this method is run when the class is loaded by the
application (which is on application startup,). Normal ruby beahviour
for methods called directly in a classes body.
As in development mode, classes are reloaded again on each request
(well, actually lazy-loaded since 2.3, so only loaded when the app
actually uses them), this code gets run everytime the Model is used in
any way.

However, the above line doesn't actually run the validation, it
CREATES/ASSIGNS the validation, which in turn isn't  run until the
instance gets validated.

so your debugger breakpoint is simply in the wrong place.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to