From 39af3f1b79618f128c29eb9b7f182c8ba79d9302 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 5 Mar 2012 12:46:41 +0000 Subject: [PATCH] Merged r8804 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.3-stable@9113 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/project.rb | 2 +- test/unit/helpers/application_helper_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/project.rb b/app/models/project.rb index e636c33de..cdb460ed6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -253,7 +253,7 @@ class Project < ActiveRecord::Base def to_param # id is used for projects with a numeric identifier (compatibility) - @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id : identifier) + @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id.to_s : identifier) end def active? diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index c5d644cf7..b261fd319 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -925,6 +925,14 @@ RAW link_to_project(project, {:action => 'settings'}, :class => "project") end + def test_link_to_legacy_project_with_numerical_identifier_should_use_id + # numeric identifier are no longer allowed + Project.update_all "identifier=25", "id=1" + + assert_equal 'eCookbook', + link_to_project(Project.find(1)) + end + def test_principals_options_for_select_with_users users = [User.find(2), User.find(4)] assert_equal %(),