Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
module ActiveRecord class Errors def full_messages_with_attr_mapping(mappings) mappings.symbolize_keys! full_messages = [] @errors.each_key do |attr| @errors[attr].each do |msg| next if msg.nil? if attr == "base" full_messages << msg else full_messages << (mappings[attr.to_sym] || @base.class.human_attribute_name(attr)) + " " + msg end end end full_messages end end end
From the Design Piracy series on my blog: