0.0
No commit activity in last 3 years
No release in over 3 years
This gem looks at the schema for any validations that it can easily apply based on known db constraints and adds application level validations for them
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Auto validation

Automatically use PostgreSQL table constraints as model validations

Tests run on Ruby 1.9.2 using Rails 3.2.1

Currently supports the following constraints:

  • NULL constraint
  • Numeric fields
  • Single column indexes (including lower indexes)
  • Multi column indexes

TODO:

Immediate TODOs

  • More efficient index validation
  • simple check constraints in PostgreSQL
  • Reduce the number of queries to get the information that is needed

Long term TODOs

  • Add support for MySQL

Very long term TODOs

  • Add support for DataMapper
  • Add support for Sequel

INSTALL

To install simply add the following to your Gemfile

gem 'auto_validate', :git => "git://github.com/omarqureshi/auto_validate.git"

USAGE

Simply insert auto_validate in your class

class Foo < ActiveRecord::Base
  auto_validate
end

TESTS

Before running tests, ensure you run rake test:prepare so that the test database is created