Dm-validations-ext is a project mainly written in Ruby, based on the MIT license.
Various additions to the dm-validations API
= dm-validations-ext
DataMapper plugin providing access to validation errors of associated parent and children objects. See the example below to get an idea on how it works.
= Example
DataMapper.setup :default, "sqlite::memory"
class User include DataMapper::Resource
property :id, Serial
property :name, String
belongs_to :group
has n, :roles
end
class Group include DataMapper::Resource
property :id, Serial
property :name, String, :length => 10..255
has n, :users
end
class Role include DataMapper::Resource
property :id, Serial
property :name, String, :length => 4..10
belongs_to :user
end
DataMapper.finalize DataMapper.auto_migrate!
user = User.new(:name => "John") group = Group.new(:name => "Too Short") role = Role.new(:name => "Way Too Long")
user.group = group user.roles << role
user.save
user.errors[:group].inspect
user.errors[:roles].inspect