Created
November 11, 2009 06:47
-
-
Save xxx/231720 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'dm-core' | |
require 'dm-validations' | |
class Foo | |
include DataMapper::Resource | |
property :id, Serial | |
property :age_check, Boolean # change this to String and the validation works as expected | |
validates_is_accepted :age_check, :allow_nil => false, :message => 'You need to check the age' | |
end | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
DataMapper.auto_migrate! | |
p Foo.new(:age_check => false).valid? # true, should be false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment