simpleweb/simple-validators

Name: simple-validators

Owner: Simpleweb

Description: Rails validators

Created: 2013-04-05 09:24:44.0

Updated: 2013-12-19 12:19:23.0

Pushed: 2013-12-19 12:19:21.0

Homepage: null

Size: 164

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Simple validators

Installation

Add this line to your application's Gemfile:

gem 'simple-validators'

And then execute:

$ bundle
Model validations

To use model validations include Simple::Validators in your model.

s User < ActiveRecord::Base
clude Simple::Validators

tr_accessible :email, :username

lidates :email, presence: true, email: true
lidates :username, presence: true, username: true

Subdomain validator
s Account < ActiveRecord::Base
clude Simple::Validators

tr_accessible :subdomain

lidates :subdomain, presence: true, uniqueness: true, subdomain: true

You can also pass a custom list of reserved subdomains, eg:

dates :subdomain, subdomain: { reserved: %w[www mail ftp home test] }
Contributing
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.