]> source.dussan.org Git - redmine.git/commitdiff
Fixed: "Template is missing" error when validation fails on version edit (#6766).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 1 Nov 2010 13:13:32 +0000 (13:13 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Mon, 1 Nov 2010 13:13:32 +0000 (13:13 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4354 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/versions_controller.rb
test/functional/versions_controller_test.rb

index 48612c7b8f50e0493674c48c11ca7882fbf15e6e..03af71b993b67d6dad4da198bb73dba2b3572974 100644 (file)
@@ -109,6 +109,10 @@ class VersionsController < ApplicationController
       if @version.update_attributes(attributes)
         flash[:notice] = l(:notice_successful_update)
         redirect_to :controller => 'projects', :action => 'settings', :tab => 'versions', :id => @project
+      else
+        respond_to do |format|
+          format.html { render :action => 'edit' }
+        end
       end
     end
   end
index e4ac5c0685031188f2c5ab6c7d1c8437681b5f49..50f33c69f8e7694ab4346bc6723f5a52b2dff8d6 100644 (file)
@@ -123,6 +123,15 @@ class VersionsControllerTest < ActionController::TestCase
     assert_equal 'New version name', version.name
     assert_equal Date.today, version.effective_date
   end
+  
+  def test_post_update_with_validation_failure
+    @request.session[:user_id] = 2
+    put :update, :id => 2, 
+                 :version => { :name => '', 
+                               :effective_date => Date.today.strftime("%Y-%m-%d")}
+    assert_response :success
+    assert_template 'edit'
+  end
 
   def test_destroy
     @request.session[:user_id] = 2