1
내가 ActiveMerchant 신용 카드 유효성 검사에 문제가 검증되지 않습니다. (ActiveMerchant 1.4.1) ActiveMerchant 내 레일에서 2.3.2 응용 프로그램을 유효하지 않은 신용 카드
나는 정확히 railscast # 145 에피소드 코드를 따랐다. 내가 좋아하는 유효하지 않은 데이터와 신용 카드를 확인 중입니다 때 내 문제가: FIRST_NAME을 : ActiveMerchant는 검증 오류
내 스크립트/콘솔에서이 시도
을 제공하지 않습니다, 비어 LAST_NAMEcredit_card = ActiveMerchant::Billing::CreditCard.new(:number => "",:first_name => "")
credit_card.errors.full_messages #=> []
credit_card.errors #=> {}
신용 카드 오류 #이,691을 만들어 내 컨트롤러에서 만든 객체를 @payment에 추가되지 않습니다
validate_on_create :validate_card
private
def validate_card
unless credit_card.valid?
credit_card.errors.full_messages.each do |message|
errors.add_to_base message
end
end
end
def credit_card
@credit_card = ActiveMerchant::Billing::CreditCard.new(
:number => card_number,
:month => card_expires_on.month,
:year => card_expires_on.year,
:first_name => first_name,
:last_name => last_name,
:verification_value => cvv_number,
:type => card_type
)
end
내 payment.rb는 포함 내가 실수를 한 곳
안녕하세요 Vinu, 감사의 해결 내 문제에 – Krishna