プロジェクト

全般

プロフィール

Vote #76408

完了

acts_as_versioned not compatible with ActiveRecord 4.2.1

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Rails support_44
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
44
version_id:
97
issue_org_id:
19957
author_id:
8216
assigned_to_id:
1
comments:
9
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
96
ステータス-->[Closed]

説明

Method type_cast is now renamed to type_cast_from_database.


journals

https://github.com/redmine/redmine/pull/55
> I noticed exceptions when plugin use acts_as_versioned because of ActiveRecord.

--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
https://patch-diff.githubusercontent.com/raw/redmine/redmine/pull/55.diff
<pre><code class="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
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Can we have a test that triggers this error in Redmine?
--------------------------------------------------------------------------------
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).
--------------------------------------------------------------------------------
Patch committed.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,19959,use paper_trail gem instead of bundled acts_as_versioned
relates,Closed,24348,acts_as_versioned use old style (Rails 2.x) of method call for #all

Admin Redmine さんが3年以上前に更新

  • カテゴリRails support_44 にセット
  • 対象バージョン3.0.4_97 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0