Don't set YAML on serialized fields #1233
This commit is contained in:
parent
fd306095c6
commit
0b567641bc
|
@ -368,7 +368,7 @@ class Issue < ActiveRecord::Base
|
||||||
def attachment_removed(obj)
|
def attachment_removed(obj)
|
||||||
init_journal(User.current)
|
init_journal(User.current)
|
||||||
create_journal
|
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
|
end
|
||||||
|
|
||||||
# Return true if the issue is closed, otherwise false
|
# Return true if the issue is closed, otherwise false
|
||||||
|
|
|
@ -98,7 +98,7 @@ class WikiContent < ActiveRecord::Base
|
||||||
changes.delete("text")
|
changes.delete("text")
|
||||||
changes["data"] = hash[:text]
|
changes["data"] = hash[:text]
|
||||||
changes["compression"] = hash[:compression]
|
changes["compression"] = hash[:compression]
|
||||||
update_attribute(:changes, changes.to_yaml)
|
update_attribute(:changes, changes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def text
|
def text
|
||||||
|
|
|
@ -31,7 +31,7 @@ class AddChangesFromJournalDetailsForActsAsJournalized < ActiveRecord::Migration
|
||||||
changes["attachments_" + detail.prop_key.to_s] = [detail.old_value, detail.value]
|
changes["attachments_" + detail.prop_key.to_s] = [detail.old_value, detail.value]
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
journal.update_attribute(:changes, changes.to_yaml)
|
journal.update_attribute(:changes, changes)
|
||||||
rescue ActiveRecord::RecordInvalid => ex
|
rescue ActiveRecord::RecordInvalid => ex
|
||||||
puts "Error saving: #{journal.class.to_s}##{journal.id} - #{ex.message}"
|
puts "Error saving: #{journal.class.to_s}##{journal.id} - #{ex.message}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,7 @@ class MergeWikiVersionsWithJournals < ActiveRecord::Migration
|
||||||
changes = {}
|
changes = {}
|
||||||
changes["compression"] = wv.compression
|
changes["compression"] = wv.compression
|
||||||
changes["data"] = wv.data
|
changes["data"] = wv.data
|
||||||
journal.update_attribute(:changes, changes.to_yaml)
|
journal.update_attribute(:changes, changes)
|
||||||
journal.update_attribute(:version, wv.version)
|
journal.update_attribute(:version, wv.version)
|
||||||
end
|
end
|
||||||
# drop_table :wiki_content_versions
|
# drop_table :wiki_content_versions
|
||||||
|
|
|
@ -170,14 +170,14 @@ class ActiveSupport::TestCase
|
||||||
|
|
||||||
should "use the new value's name" do
|
should "use the new value's name" do
|
||||||
@detail = IssueJournal.generate(:version => 1, :journaled => Issue.last)
|
@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)
|
assert_match @new_value.class.find(@new_value.id).name, @detail.render_detail(prop_key, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "use the old value's name" do
|
should "use the old value's name" do
|
||||||
@detail = IssueJournal.generate(:version => 1, :journaled => Issue.last)
|
@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)
|
assert_match @old_value.class.find(@old_value.id).name, @detail.render_detail(prop_key, true)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue