Created
February 13, 2009 08:38
-
-
Save kiko/63801 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> ruby --version | |
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux] | |
> cat validate_test.rb | |
require 'not_naughty' | |
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 | |
> ruby validate_test.rb | |
validate_test.rb:5: undefined local variable or method `presence' for #<NotNaughty::ClassMethods::Builder:0xb7a5ce60> (NameError) | |
from /home/kiko/projects/others/not-naughty/lib/not_naughty/class_methods.rb:23:in `instance_eval' | |
from /home/kiko/projects/others/not-naughty/lib/not_naughty/class_methods.rb:23:in `validates' | |
from validate_test.rb:5 | |
from validate_test.rb:3:in `new' | |
from validate_test.rb:3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment