I have a model V1::Profile::Subnet inheritance from V1::Profile::Base
module V1
class Profile::Subnet < V1::Profile::Base
end
end
base model:
module V1
class Profile::Base < CouchRest::Model::Base
use_database $DATABASE_AV_TESTS
property :name, String
validates :name, :presence => {:message => 'cannot be blank, Profile not saved'},
:uniqueness => {:message => 'Profile name must be unique, Profile not saved'},
:length => {:maximum => 255, :message => 'is too long (maximum is 255 characters)'}
validates :author, :presence => {:message => 'cannot be blank, Profile not saved'}
end
end
If I saved two subnet with same name, it didn't complain, if I save a subnet with blank name , it complains, it is wired that validation presence works, but not uniqueness, any one has idea?
Aucun commentaire:
Enregistrer un commentaire