0
我有模型關聯如下:軌與各協會ActiveRecord的驗證
class Group < ActiveRecord::Base
has_many :group_links, :dependent => :destroy
end
class GroupLink < ActiveRecord::Base
belongs_to :group
validates_presence_of :group_id
validates_presence_of :url, :message => "We need a url to create a link"
validates_uniqueness_of :url, :message => "A link with this url already exists"
validates_presence_of :text, :message => "We need a text to create a link"
validates_uniqueness_of :text, :message => "A link with this text already exists"
end
我希望它像每個組的組鏈接應該是唯一的工作。然而,它的工作方式是,即使某些其他組擁有簡化組鏈接,它也會拋出驗證錯誤。
我在做什麼錯?
在此先感謝,