Sha256: 2b647a552bd3d9135f6025fd1c2e83ed50a1017a86e00bc1491ea325096f1267

Contents?: true

Size: 993 Bytes

Versions: 1

Compression:

Stored size: 993 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
    # add this to your Gemfile
    gem "credit_card_validation"

    # and run
    bundle

### Usage

#### With ActiveRecord
    class Order < ActiveRecord::Base
      # standard validation
      validates :card_number, credit_card: true

      # with legacy syntax
      validates_credit_card :card_number
    end

#### With ActiveModel
    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

1 entries across 1 versions & 1 rubygems

Version Path
credit_card_validation-0.0.1 README.mdown