目前我有一个脚本,用于检查以确保未在生产中提交测试卡(因为 Authorize.net 在实时模式下接受测试信用卡),如果提交的信用卡号在Test_Credit_Cards
像这样的数组:
TEST_CREDIT_CARDS = ['370000000000002', '6011000000000012', '4007000000027', '4012888818888']
validate :not_a_test_credit_card
def not_a_test_credit_card
self.errors[:cc_number] << "number is invalid!" if TEST_CREDIT_CARDS.include?(cc_number) and Rails.env.production?
end
现在在前端,错误消息如下所示:
Credit card cc number is invalid!
无论如何要将消息更改为阅读Credit Card number is invalid!
我只想cc
从消息中删除该部分。