Skip to content

Instantly share code, notes, and snippets.

@xxx
Created November 11, 2009 06:47
Show Gist options
  • Save xxx/231720 to your computer and use it in GitHub Desktop.
Save xxx/231720 to your computer and use it in GitHub Desktop.
#!/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