@@ -253,7 +253,7 class Project < ActiveRecord::Base | |||||
253 |
|
253 | |||
254 | def to_param |
|
254 | def to_param | |
255 | # id is used for projects with a numeric identifier (compatibility) |
|
255 | # id is used for projects with a numeric identifier (compatibility) | |
256 | @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id : identifier) |
|
256 | @to_param ||= (identifier.to_s =~ %r{^\d*$} ? id.to_s : identifier) | |
257 | end |
|
257 | end | |
258 |
|
258 | |||
259 | def active? |
|
259 | def active? |
@@ -925,6 +925,14 RAW | |||||
925 | link_to_project(project, {:action => 'settings'}, :class => "project") |
|
925 | link_to_project(project, {:action => 'settings'}, :class => "project") | |
926 | end |
|
926 | end | |
927 |
|
927 | |||
|
928 | def test_link_to_legacy_project_with_numerical_identifier_should_use_id | |||
|
929 | # numeric identifier are no longer allowed | |||
|
930 | Project.update_all "identifier=25", "id=1" | |||
|
931 | ||||
|
932 | assert_equal '<a href="/projects/1">eCookbook</a>', | |||
|
933 | link_to_project(Project.find(1)) | |||
|
934 | end | |||
|
935 | ||||
928 | def test_principals_options_for_select_with_users |
|
936 | def test_principals_options_for_select_with_users | |
929 | users = [User.find(2), User.find(4)] |
|
937 | users = [User.find(2), User.find(4)] | |
930 | assert_equal %(<option value="2">John Smith</option><option value="4">Robert Hill</option>), |
|
938 | assert_equal %(<option value="2">John Smith</option><option value="4">Robert Hill</option>), |
General Comments 0
You need to be logged in to leave comments.
Login now