]> source.dussan.org Git - redmine.git/commitdiff
Fixed: Bulk edit of issues throws 500 if no versions are defined on the project ...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 9 Dec 2009 09:22:16 +0000 (09:22 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 9 Dec 2009 09:22:16 +0000 (09:22 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3140 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/projects_helper.rb
test/unit/helpers/projects_helper_test.rb

index b675f6b34363a1d910d94ce54496a5e83f243282..896c54d923db703a83dbc33e6a5e9710b8d0e815 100644 (file)
@@ -84,7 +84,7 @@ module ProjectsHelper
     if grouped.keys.size > 1
       grouped_options_for_select(grouped, selected && selected.id)
     else
-      options_for_select(grouped.values.first, selected && selected.id)
+      options_for_select((grouped.values.first || []), selected && selected.id)
     end
   end
 
index ce95988419dfb5b3e08f6eaedfc8a6fd0b549c7f..ff99a15c9831506e6a89b28ef9d8c01521155633 100644 (file)
@@ -60,4 +60,9 @@ class ProjectsHelperTest < HelperTestCase
   def test_format_version_name_for_system_version
     assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7))
   end
+  
+  def test_version_options_for_select_with_no_versions
+    assert_equal '', version_options_for_select([])
+    assert_equal '<option value="1" selected="selected">0.1</option>', version_options_for_select([], Version.find(1))
+  end
 end