Project

General

Profile

Actions

Defect #19957

closed

acts_as_versioned not compatible with ActiveRecord 4.2.1

Added by taha mohammed el kahlaoui over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Rails support
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Method type_cast is now renamed to type_cast_from_database.


Related issues

Related to Redmine - Feature #19959: use paper_trail gem instead of bundled acts_as_versionedClosed

Actions
Related to Redmine - Defect #24348: acts_as_versioned use old style (Rails 2.x) of method call for #allClosedJean-Philippe Lang

Actions
Actions #1

Updated by Toshi MARUYAMA over 9 years ago

https://github.com/redmine/redmine/pull/55

I noticed exceptions when plugin use acts_as_versioned because of ActiveRecord.

Actions #2

Updated by Toshi MARUYAMA over 9 years ago

It seems acts_as_versioned is dead.
https://github.com/JoelJuliano/acts_as_versioned

I think we would better use paper_trail gem instead.
https://github.com/airblade/paper_trail

Actions #3

Updated by Toshi MARUYAMA over 9 years ago

  • Target version set to 3.0.4

https://patch-diff.githubusercontent.com/raw/redmine/redmine/pull/55.diff

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 618cf07..224a0c7 100644
--- a/lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb
+++ b/lib/plugins/acts_as_versioned/lib/acts_as_versioned.rb
@@ -447,7 +447,7 @@ def clear_altered_attributes

           def write_changed_attribute(attr_name, attr_value)
             # Convert to db type for comparison. Avoids failing Float<=>String comparisons.
-            attr_value_for_db = self.class.columns_hash[attr_name.to_s].type_cast(attr_value)
+            attr_value_for_db = self.class.columns_hash[attr_name.to_s].type_cast_from_database(attr_value)
             (self.altered_attributes ||= []) << attr_name.to_s unless self.changed?(attr_name) || self.send(attr_name) == attr_value_for_db
             write_attribute(attr_name, attr_value_for_db)
           end

Actions #4

Updated by Toshi MARUYAMA over 9 years ago

  • Related to Feature #19959: use paper_trail gem instead of bundled acts_as_versioned added
Actions #5

Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Needs feedback

Can we have a test that triggers this error in Redmine?

Actions #6

Updated by Toshi MARUYAMA over 9 years ago

Jean-Philippe Lang wrote:

Can we have a test that triggers this error in Redmine?

I think we don't use this code, so we cannot test.
We cannot manage unused code of bundled gem, so we should use maintained gem instead (#19959).

Actions #7

Updated by Jean-Philippe Lang over 9 years ago

  • Category set to Rails support
  • Status changed from Needs feedback to Resolved
  • Resolution set to Fixed

Patch committed.

Actions #8

Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Jean-Philippe Lang
Actions #9

Updated by Toshi MARUYAMA almost 8 years ago

  • Related to Defect #24348: acts_as_versioned use old style (Rails 2.x) of method call for #all added
Actions

Also available in: Atom PDF