未定义的方法add_to_base [英] Undefined method add_to_base
本文介绍了未定义的方法add_to_base的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用activemerchant,它在验证卡时在滑轨3上还可以吗?预先谢谢大家的力量
I'm working with activemerchant and it raise me this error when validating the card is this ok in rails 3? thank you in advance more power to all
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
推荐答案
add_to_base
方法已从导轨3中删除.您应该改用errors[:base] << "error"
.
add_to_base
method was removed from rails 3. You should use errors[:base] << "error"
instead.
这篇关于未定义的方法add_to_base的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文