Wes Gamble
2006-Jul-11 22:23 UTC
[Rails] Clearing out AR object''s errors array on multiple form posts
I have a form that is POSTing to modify an ActiveRecord object @obj. I''m using @obj.errors.add() to add to the set of errors for this form. When I post with incorrect data, I see the error message. However, if I post again, without changing anything, the error is being added to the array. Should I be calling @obj.errors.clear at the beginning of my controller action to ensure that I don''t keep appending to the array? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
Possibly Parallel Threads
- Multiple file uploads - only one file object gets posted
- text_field doesn''t call overridden ActiveRecord getters
- Theoretical: Should models be subclasses of AR or mix it in?
- Best Practices: Splitting the "view model" from AR model
- Wrap error_messages_for() call when no instance var present