Skip to content

robworley/schema-validations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Schema Validations

DRY up your ActiveRecord validations based on schema information.

ActiveRecord::Base.send(:include, SchemaValidations)

Use skip_schema_validations when you need to circumvent validation of specific attributes. This is particularly useful when a field that does not permit nulls will be populated after validation.

class User < ActiveRecord::Base
  skip_schema_validations :crypted_password
end

Much of this code was plagiarized from Simon Harris’ Redhill on Rails work. I simply fixed it up for Rails 2.3.x, added test coverage and removed some of the more problematic validations for uniqueness, precision, scale etc. It’s not quite as comprehensive but it’s a useful foundation to build upon.

About

DRY up your ActiveRecord validations based on schema information.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages