Allow non-unique names for projects (#630).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4391 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-11-11 13:39:14 +00:00
parent 7482d2f5f4
commit fa3d71bed9
3 changed files with 2 additions and 3 deletions

View File

@ -524,7 +524,7 @@ module ApplicationHelper
esc, all, page, title = $1, $2, $3, $5
if esc.nil?
if page =~ /^([^\:]+)\:(.*)$/
link_project = Project.find_by_name($1) || Project.find_by_identifier($1)
link_project = Project.find_by_identifier($1) || Project.find_by_name($1)
page = $2
title ||= $1 if page.blank?
end

View File

@ -64,7 +64,7 @@ class Project < ActiveRecord::Base
attr_protected :status, :enabled_module_names
validates_presence_of :name, :identifier
validates_uniqueness_of :name, :identifier
validates_uniqueness_of :identifier
validates_associated :repository, :wiki
validates_length_of :name, :maximum => 30
validates_length_of :homepage, :maximum => 255

View File

@ -29,7 +29,6 @@ class ProjectTest < ActiveSupport::TestCase
should_validate_presence_of :name
should_validate_presence_of :identifier
should_validate_uniqueness_of :name
should_validate_uniqueness_of :identifier
context "associations" do