Commit 296db927 authored by Holger Just's avatar Holger Just

Don't set YAML on serialized fields #1233

parent 3eae0584
......@@ -364,7 +364,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
......
......@@ -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
......
......@@ -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
......
......@@ -37,7 +37,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
......
......@@ -168,14 +168,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment