handle is unique within the scope of a site

This commit is contained in:
Didier Lafforgue 2012-04-11 00:21:20 +02:00
parent 14596a5443
commit 63fd77f950
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ module Locomotive
end end
# It returns a pretty output of the fullpath. The "*" characters # It returns a pretty output of the fullpath. The "*" characters
# are replaced by the following pattern ":<slug>" like you can find # are replaced by the following pattern ":<slug>" like the ones you can find
# in the Ruby on Rails routes. # in the Ruby on Rails routes.
# #
def pretty_fullpath def pretty_fullpath

View File

@ -40,7 +40,7 @@ module Locomotive
## validations ## ## validations ##
validates_presence_of :site, :title, :slug validates_presence_of :site, :title, :slug
validates_uniqueness_of :slug, :scope => [:site_id, :parent_id] validates_uniqueness_of :slug, :scope => [:site_id, :parent_id]
validates_uniqueness_of :handle, :allow_blank => true validates_uniqueness_of :handle, :allow_blank => true, :scope => [:site_id]
validates_exclusion_of :slug, :in => Locomotive.config.reserved_slugs, :if => Proc.new { |p| p.depth <= 1 } validates_exclusion_of :slug, :in => Locomotive.config.reserved_slugs, :if => Proc.new { |p| p.depth <= 1 }
## named scopes ## ## named scopes ##