我有一个模型 V1::Profile::Subnet 从 V1::Profile::Base 继承
module V1
class Profile::Subnet < V1::Profile::Base
end
end
基本型号:
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
如果我保存了两个具有相同名称的子网,它不会抱怨,如果我用空白名称保存一个子网,它会抱怨,验证存在有效,但不是唯一性,有人知道吗?