Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Automatic Rails validations from your database

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 database_validation.gemspec
README.md

DatabaseValidation

We write a lot of validations in our ActiveRecord models that already exist inside of our database. This gem automatically creates those validations.

Usage

We need more tools that use tools we already have

class Thing < ActiveRecord::Base
  include DatabaseValidation
end

What's automatically created

For now:

  • validates_uniquness_of (with scope)
  • validates_presence_of
  • validates_inclusion_of (for booleans)
  • validates_length_of :maximum, :allow_nil
  • validates_numericality_of :greater_than, :less_than, :allow_nil

Tested Adapters (probably others)

  • mysql
  • mysql2

Installation

# in your Gemfile
gem 'database_validation'

Author

John Crepezzi john.crepezzi@gmail.com

Something went wrong with that request. Please try again.