This project is archived and is in readonly mode.
transactions don't fail in 3.0
-
Jeremy Kemper
- Milestone cleared.
- State changed from new to open
- Assigned user set to Jeremy Kemper
The root problem here is that the 'validate' method isn't being called, so the record saves. Looking into it.
-
Daniel Guettler
The reason why this is failing is because validate is a private method and overriding 'validate' is a deprecated callback. So this calls 'deprecated_callback_method' which checks if the object responds to the passed method. If the method is private it will return false and 'validate' is never executed. If the method is not private validation works fine.
It also works if the new syntax Account.validate(:balance_positive) is used. There it doesn't matter if the method is private or not. -
Daniel Guettler
Upps, this should say: 'validate is defined as private in the given example'...
-
Repository
(from [40c4a0036a690b2e0e3157520f1851efc77fbef7]) Ensure deprecated validate methods are invoked when they are private [#3214 transactions don't fail in 3.0 status:resolved] http://github.com/rails/rails/commit/40c4a0036a690b2e0e3157520f1851...
-
José Valim
- State changed from open to resolved
Thanks Daniel, the information you provided helped fix the issue.
