This project is archived and is in readonly mode.
2.1.2 changes ActiveRecord validation sequence for associations
Reported by Ahmet Dogramaci | October 30th, 2008 @ 12:14 PM | in 2.x
Person has one ContactInfo.
class Person < ActiveRecord::Base has_one :contact_info, :as => :contactable, :dependent => :destroy end
On rails 2.1.0 ContactInfo validation is done before Person validation. So, I can catch the errors in the contact info in Person after_validation call back. This is necessary since I only display a single form to the user.
When I migrate the same code to 2.1.2, it looks like ContactInfo validation is done after Person validation. So, I can not catch the contact info error in Person after_validation call back.
To me, this looks like a problem that would affect many applications since you can not catch dependent association errors.
Comments and changes to this ticket
-
Pratik March 12th, 2009 @ 04:08 PM
- State changed from new to invalid
That's expected behaviour. You could also play with :validate => true/false to match your needs.
Thanks
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>