From 0daee3cb987ee16a7a7ad6f6513897f5ce856282 Mon Sep 17 00:00:00 2001 From: Mahmoud Khaled Date: Mon, 5 Nov 2012 11:46:32 +0200 Subject: [PATCH] fix comparison of Symbol with Arel::Table failed exception when update wiki contents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit when I try to update a wiki content in redmine 2, it throws exception  ArgumentError (comparison of Symbol with Arel::Table failed):   lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb:438:in `next_version'   lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb:432:in `set_new_version'   app/controllers/wiki_controller.rb:152:in `update' This should use maximum not calculate :max --- lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb b/lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb index 7510462bd0c..9648a80cb51 100644 --- a/lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb +++ b/lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb @@ -435,7 +435,7 @@ def set_new_version # Gets the next available version for the current record, or 1 for a new record def next_version return 1 if new_record? - (versions.calculate(:max, :version) || 0) + 1 + (versions.maximum(:version) || 0) + 1 end # clears current changed attributes. Called after save.