Agile Web Development with Rails, Edition 4

Agile Web Development with Rails, Edition 4

26.2 Asset Packager 25.2 rake

26.1 Active Merchant

Determine if a credit card is valid

edit Gemfile
gem 'will_paginate', '~> 3.0'
gem 'activemerchant', '~> 1.10.0'
bundle install
Using rake (0.9.2.2) 
Using abstract (1.0.0) 
Using activesupport (3.0.15) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.15) 
Using erubis (2.6.6) 
Using rack (1.2.5) 
Using rack-mount (0.6.14) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.33) 
Using actionpack (3.0.15) 
Using mime-types (1.19) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.2.19) 
Using actionmailer (3.0.15) 
Using braintree (2.16.0) 
Using activemerchant (1.10.0) 
Using arel (2.0.10) 
Using activerecord (3.0.15) 
Using activeresource (3.0.15) 
Using bundler (1.1.3) 
Using highline (1.6.13) 
Using net-ssh (2.5.2) 
Using net-scp (1.0.4) 
Using net-sftp (2.0.5) 
Using net-ssh-gateway (1.1.0) 
Using capistrano (2.12.0) 
Using json (1.7.3) 
Using mysql (2.8.1) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.0.15) 
Using rails (3.0.15) 
Using sqlite3 (1.3.6) 
Using will_paginate (3.0.3) 
Updating .gem files in vendor/cache
Could not find activesupport-3.0.15.gem for installation
edit script/creditcard.rb
credit_card = ActiveMerchant::Billing::CreditCard.new(
  :number     => '4111111111111111',
  :month      => '8',
  :year       => '2009',
  :first_name => 'Tobias',
  :last_name  => 'Luetke',
  :verification_value  => '123' 
)
 
puts "Is #{credit_card.number} valid?  #{credit_card.valid?}"
rails runner script/creditcard.rb
Is 4111111111111111 valid?  false

26.2 Asset Packager 25.2 rake