Overriding Rails Error (Validation) Messages from Gems/Plugins -
is there accepted way of overriding error (validation) messages gem/plugin in rails? for example, i'm using activemerchant gem, , if puts in american express credit card number, selects 'mastercard', not-very-descriptive "type not correct card type" error. i can around doing this: def validate_card unless credit_card.valid? credit_card.errors.full_messages.each |message| if message =~ /is not correct card type/i errors.add_to_base "this credit card number invalid. please ensure selected correct type." else errors.add_to_base message end end end end but technique becomes unmaintainable , (at least in opinion) far 'best-practices'. similarly, unpack activemerchant gem , hack put in own custom error messages, seems unmaintainable require same hacks added future, unpacked, versions of activemerchant. in honesty, you're best bet either rewrite parts ...