Hi there,

I've got a custom setter in a model that add errors in the case that the
given value is invalid. In the case that it is invalid, I've had a lot of
difficulty getting the model to validate false. It looks like in active
model we call errors.clear before run_validations!. This makes sense to me,
as you might save a record, validate false, update the values, and then not
want to keep the old errors.

Is there any way around this? Best I could come up with is to set an
attr_accessor flag to :invalid if the setter was invalid and then validate
absence of that attr_accessor.

Would there be interest in a PR that extended errors to have some
persistent values through the validation stack? As in, you set a sticky
error that doesn't get removed when you call valid? Or something? Sorry,
that part of this is not super thought-out.

-- 
*Kevin D. Deisz*
*TrialNetworks* - part of DrugDev
Software Developer
383 Elliot Street, Suite G
Newton, MA 02464
+1 617.952.4071 x134 (office)
+1 703.615.0396 (mobile)
[email protected]

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to