diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-06 14:44:40 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-06 14:44:40 +0000 |
commit | dfbab5d61ee7b106a715a353074053041312b9b0 (patch) | |
tree | 9968c9732f323e828461fe519189dfa78bc071d1 | |
parent | 6f1d553cff1affcd7d819636444c7416b153636c (diff) | |
download | redmine-dfbab5d61ee7b106a715a353074053041312b9b0.tar.gz redmine-dfbab5d61ee7b106a715a353074053041312b9b0.zip |
Fixed "can't convert Fixnum into String" error on projects with numerical identifier (#10135).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8804 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 8a79ed674..407f723c4 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -274,7 +274,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 20e458b7b..3e00030b5 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -920,6 +920,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 '<a href="/projects/1">eCookbook</a>', + link_to_project(Project.find(1)) + end + def test_principals_options_for_select_with_users User.current = nil users = [User.find(2), User.find(4)] |