我正在与 activemerchant 合作,它在验证卡时引发了这个错误,这在 rails 3 中可以吗?提前谢谢你给所有人更多的权力
belongs_to :reservation
attr_accessor :card_number, :card_verification
validate :validate_card, :on => :create
def validate_card
unless credit_card.valid?
credit_card.errors.full_messages.each do |message|
errors.add_to_base "error"
end
end
end
def credit_card
@credit_card ||= ActiveMerchant::Billing::CreditCard.new(
:type => card_type,
:number => card_number,
:verification_value => card_verification,
:month => card_expires_on.month,
:year => card_expires_on.year,
:first_name => first_name,
:last_name => last_name
)
end
它指向Undefined method add_to_base