This project is archived and is in readonly mode.
ActiveRecord::Error does not allow values to add errors
Reported by José Valim | November 10th, 2009 @ 01:08 PM | in 2.3.6
(Message from #3147 by Chris Hapgood)
Briefly: an error on an attribute cannot be set as the result of an exception computing the value of the attribute.
For example:
def v compute_it rescue errors.add(:v, "Dadgummit") end
When compute_it raise an exception, ActiveRecord::Error#initialize references v, which in turn raises another exception, which adds another error, which in turn proves that my stack is not infinitely deep.
Is it reasonable to assume that ActiveRecord::Error instances can reference its erroneous attribute's value? If so, the above pattern won't work and instead a sentinel value will need to be set (U-G-L-Y).
Comments and changes to this ticket
-
Repository November 10th, 2009 @ 06:26 PM
(from [a4540128a4433f246850a6cdc10d602180dac431]) [PATCH] Optimize Error I18n to avoid unecessary lookups and just retrieve values when needed [#3477 status:resolved].
Signed-off-by: Joshua Peek josh@joshpeek.com
http://github.com/rails/rails/commit/a4540128a4433f246850a6cdc10d60... -
josh November 10th, 2009 @ 06:27 PM
- State changed from new to resolved
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>
People watching this ticket
Attachments
Tags
Referenced by
- 3147 ActiveRecord::Error#full_message broken when used with I18n and autosave associations @Chris, I debugged a little bit. This error happens since...
- 3477 ActiveRecord::Error does not allow values to add errors (from [a4540128a4433f246850a6cdc10d602180dac431]) [PATCH]...