Skip to content

Instantly share code, notes, and snippets.

@boof
Forked from kiko/gist:63801
Created February 15, 2009 07:20
Show Gist options
  • Save boof/64634 to your computer and use it in GitHub Desktop.
Save boof/64634 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'not_naughty'
# Load the validations you want to use.
NotNaughty::Validation.load 'length', 'presence'
Person = Struct.new(:name) do
extend NotNaughty
validates(:name) { presence and length :minimum => 4 }
end
Person.new('Horst').valid? # => true
Person.new('Foo').valid? # => false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment