search for: _error_types

Displaying 1 result from an estimated 1 matches for "_error_types".

Did you mean: error_types
2012 Sep 25
3
Proposal for a new ActiveModel::Errors structure
...] } Currently it''s impossible to figure out which validations actually failed for a given field, as AM::Errors provides only field name and translated error message. We''ve got a simple workaround for this issue: module ActiveModel class Errors def error_types @_error_types ||= Hash.new{|hash,k| hash[k] = []} end def add_with_save_names(attribute, message = nil, options = {}) message ||= :invalid message = message.call if message.is_a?(Proc) error_types[attribute] << message add_without_save_names(attribute, message, options)...