Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rails-schema-validations

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rails-schema-validations

  • 0.9.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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 typerails validationextra constraints
non-nullvalidates_presence_of
stringvalidates_length_of:maximum
integervalidates_numericality_of:only_integer, :less_than
floatvalidates_numericality_of
booleanvalidates_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

FAQs

Package last updated on 09 Dec 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc