Summary ======= Add validations to your models automatically based on the schema constraints. Place this one line in your model: validations_from_schema Generated Validations ===================== | schema type | rails validation | extra constraints | |-------------|---------------------------|---------------------------| | non-null | validates_presence_of | | | string | validates_length_of | :maximum | | integer | validates_numericality_of | :only_integer, :less_than | | float | validates_numericality_of | | | boolean | validates_inclusion_of | | for boolean non-null it uses validates_inclusion_of :in => [true,false] Options ======= To exclude a column use the `:except => ['excluded']` option. Warning ======= * Tested on MySQL. Rails 2.3 and Rails 3 * Assumes signed integers for less_than constraint * Assume it doesn't work on your database unless you modify the test suite to run against your db and all tests pass
Project
rails-schema-validations
generate validations from the schema - used in production with MySQL
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
Pull Requests
Development
Dependencies
Project Readme