This project is archived and is in readonly mode.
after_validation callbacks are no longer executed if validation fails in rails3
-
Neeraj Singh
- Importance changed from to Low
ActiveModel callbacks has following line of code.
def after_validation(*args, &block) options = args.extract_options! options[:prepend] = true options[:if] = Array.wrap(options[:if]) options[:if] << "!halted && value != false" options[:if] << "self.validation_context == :#{options[:on]}" if options[:on] set_callback(:validation, :after, *(args << options), &block) endNotice options[:if] << "!halted && value != false"
It means that if validation returns false then do not call after_valdiation.
I have updated the doc http://github.com/lifo/docrails/commit/c24aa2f2dca52e1b0ee644e40738...
Whether after_validation should be called irrespective of the result is something that should be discussed with rails core team member.
-
Neeraj Singh
- Milestone cleared.
- State changed from new to open
- Assigned user set to José Valim
- Tag set to rails 3, activemodel, patch
In 2.3.x after_validation callback is called irrespective of the result of valid? . I confirmed it and it was suggested by Jeremy Davis and hence the ticket.
Attached is patch with test that fixes this issue in rails edge.
-
Jeremy Davis
Spectacular, thank you.
-
José Valim
- State changed from open to committed
Ops, this patch was applied! Closing! Thanks Neeraj!
-
learn italian online
- State changed from committed to open
The resources of the Rails core team are Ray Ban 2140 limited, and so we are asking for your help. If you can still
learn italian online reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. learn a language Likewise, if you feel that this is a very important feature for Rails to include, Ray Ban 3025 ple ase reply with your explanation so we can consider it. -
learn italian online
If you saw Sunday's Free Rosetta Stone Language Press that shown Robert Bobb the emergency financial manager for Detroit Public rosetta stone Schools, move Mark Twain to rosetta Boynton which have three times the number seats then students and was one of the reason's he gave for closing school to many em rosetta stone spanish pty seats.


