From b4423f6611440e13d2ff8489f044f78d5a4e664f Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 11 Nov 2007 04:52:23 +0000 Subject: [PATCH] adding scope check for title uniqueness git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@13 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7 --- app/models/page.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/page.rb b/app/models/page.rb index 685311e..7b31a9d 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -15,7 +15,7 @@ class Page < ActiveRecord::Base belongs_to :owner, :polymorphic => true validates_presence_of :title - validates_uniqueness_of :title + validates_uniqueness_of :title, :scope => 'owner_type' validates_format_of :title, :with => /[A-Za-z0-9 ]/, :message => 'may only contain letters, numbers and spaces' before_save :update_html @@ -33,7 +33,7 @@ class Page < ActiveRecord::Base def self.title_from_url(title) title.to_s.gsub(/_/, ' ') end - + protected ##