Sha256: ad15ec536321fb5ec4f69516303dd14f6d2f8308d6e1b7a7a36209a136007300
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 Bytes
Contents
# Credit Card Validation This gem adds the capability of validating credit cards to ActiveRecord and ActiveModel (Rails 3+) and Ruby 1.9.2+. ### Installation ```ruby # add this to your Gemfile gem "credit_card_validation" # and run bundle ``` ### Usage #### With ActiveRecord ```ruby class Order < ActiveRecord::Base # standard validation validates :card_number, credit_card: true # with legacy syntax validates_credit_card :card_number end ``` #### With ActiveModel ```ruby class Order include ActiveModel::Validations attr_accessor :card_number validates :card_number, credit_card: true end ``` #### I18n The default error message `is not a valid credit card`. You can pass the `message: "my custom error"` option to your validation to define your own, custom message. ## Authors **Rahul Trikha** (<http://twitter.com/rahult>) ## License Copyright 2013 by Rahul Trikha (<http://www.rahultrikha.com>) and is released under the MIT license.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
credit_card_validation-1.0.1 | README.mdown |
credit_card_validation-1.0.0 | README.mdown |