From 65e3a8ff30fa8025474e7512057e7b592f2e6583 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Fri, 10 Jun 2011 23:11:26 +0200 Subject: [PATCH] do not save if previous save had validation problems. this prevents test failures if you use it on a db that has been used after the aasm upgrade (forward compatible) --- app/controllers/todos_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 6d452a01..843e43de 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -90,7 +90,7 @@ class TodosController < ApplicationController @saved = @todo.save # Fix for #977 because AASM overrides @state on creation - @todo.update_attribute('state', specified_state) unless specified_state == "immediate" + @todo.update_attribute('state', specified_state) unless specified_state == "immediate" || specified_state.nil? || !@saved @saved = @todo.save @todo.update_state_from_project if @saved