Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zapnap/isbn_validation
ISBN Validation for ActiveRecord Models
https://github.com/zapnap/isbn_validation
Last synced: about 2 months ago
JSON representation
ISBN Validation for ActiveRecord Models
- Host: GitHub
- URL: https://github.com/zapnap/isbn_validation
- Owner: zapnap
- License: mit
- Created: 2008-11-03T19:06:19.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T02:49:56.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T13:29:12.455Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 37.1 KB
- Stars: 31
- Watchers: 3
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# IsbnValidation
Custom ActiveRecord Validation for International Standard Book Number (ISBN)
fields. Supports both ISBN-10 and ISBN-13. Will guarantee that validated fields
contain valid ISBNs.Default behaviour is to allow either ISBN-10 or ISBN-13, but this can be
altered by specifying the :with option as shown in the example below.For more information on ISBN, see http://en.wikipedia.org/wiki/Isbn
## Installation
To use it, add it to your Gemfile:
gem 'isbn_validation'
The current version of isbn_validation only supports Rails 3+. For Rails 2.x
support, please use v0.1.2.## Example
class Book < ActiveRecord::Base
validates :isbn, :isbn_format => true
validates :isbn10, :isbn_format => { :with => :isbn10 }
validates :isbn13, :isbn_format => { :with => :isbn13 }
endCopyright © 2015 Nick Plante, released under the MIT license