search for: add_without_save_nam

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

Did you mean: add_without_save_names
2012 Sep 25
3
Proposal for a new ActiveModel::Errors structure
...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) end alias_method_chain :add, :save_names end end This solution is far from perfect, but it''s relatively simple and so far works for us. The best solution would be to actually build a structure similar to GitHub response - from that structure...