From 0b567641bcde8b639f4cfea6f4db7a207fffd798 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Tue, 12 Feb 2013 12:10:38 +0100 Subject: [PATCH] Don't set YAML on serialized fields #1233 --- app/models/issue.rb | 2 +- app/models/wiki_content.rb | 2 +- ...dd_changes_from_journal_details_for_acts_as_journalized.rb | 2 +- .../20100804112053_merge_wiki_versions_with_journals.rb | 2 +- test/test_helper.rb | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index e4c215c9..d9047ae2 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -368,7 +368,7 @@ class Issue < ActiveRecord::Base def attachment_removed(obj) init_journal(User.current) create_journal - last_journal.update_attribute(:changes, {"attachments_" + obj.id.to_s => [obj.filename, nil]}.to_yaml) + last_journal.update_attribute(:changes, {"attachments_" + obj.id.to_s => [obj.filename, nil]}) end # Return true if the issue is closed, otherwise false diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index 1444fd4a..88e62c11 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -98,7 +98,7 @@ class WikiContent < ActiveRecord::Base changes.delete("text") changes["data"] = hash[:text] changes["compression"] = hash[:compression] - update_attribute(:changes, changes.to_yaml) + update_attribute(:changes, changes) end def text diff --git a/db/migrate/20100714111654_add_changes_from_journal_details_for_acts_as_journalized.rb b/db/migrate/20100714111654_add_changes_from_journal_details_for_acts_as_journalized.rb index 1690623e..35c093e1 100644 --- a/db/migrate/20100714111654_add_changes_from_journal_details_for_acts_as_journalized.rb +++ b/db/migrate/20100714111654_add_changes_from_journal_details_for_acts_as_journalized.rb @@ -31,7 +31,7 @@ class AddChangesFromJournalDetailsForActsAsJournalized < ActiveRecord::Migration changes["attachments_" + detail.prop_key.to_s] = [detail.old_value, detail.value] end begin - journal.update_attribute(:changes, changes.to_yaml) + journal.update_attribute(:changes, changes) rescue ActiveRecord::RecordInvalid => ex puts "Error saving: #{journal.class.to_s}##{journal.id} - #{ex.message}" end diff --git a/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb b/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb index 3cc034af..58efa457 100644 --- a/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb +++ b/db/migrate/20100804112053_merge_wiki_versions_with_journals.rb @@ -39,7 +39,7 @@ class MergeWikiVersionsWithJournals < ActiveRecord::Migration changes = {} changes["compression"] = wv.compression changes["data"] = wv.data - journal.update_attribute(:changes, changes.to_yaml) + journal.update_attribute(:changes, changes) journal.update_attribute(:version, wv.version) end # drop_table :wiki_content_versions diff --git a/test/test_helper.rb b/test/test_helper.rb index b66a5ebe..f8adc32d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -170,14 +170,14 @@ class ActiveSupport::TestCase should "use the new value's name" do @detail = IssueJournal.generate(:version => 1, :journaled => Issue.last) - @detail.update_attribute(:changes, {prop_key => [@old_value.id, @new_value.id]}.to_yaml) + @detail.update_attribute(:changes, {prop_key => [@old_value.id, @new_value.id]}) assert_match @new_value.class.find(@new_value.id).name, @detail.render_detail(prop_key, true) end should "use the old value's name" do @detail = IssueJournal.generate(:version => 1, :journaled => Issue.last) - @detail.update_attribute(:changes, {prop_key => [@old_value.id, @new_value.id]}.to_yaml) + @detail.update_attribute(:changes, {prop_key => [@old_value.id, @new_value.id]}) assert_match @old_value.class.find(@old_value.id).name, @detail.render_detail(prop_key, true) end