FIX: Allow Symbol objects to be deserialized in PostRevision (stable) (#17512)
Followup to bb287c6c74
This commit is contained in:
parent
5d2ecce3f6
commit
f0ef186a4e
@ -246,7 +246,7 @@ module Discourse
|
||||
# see: http://stackoverflow.com/questions/11894180/how-does-one-correctly-add-custom-sql-dml-in-migrations/11894420#11894420
|
||||
config.active_record.schema_format = :sql
|
||||
|
||||
config.active_record.yaml_column_permitted_classes = [Hash, HashWithIndifferentAccess, Time]
|
||||
config.active_record.yaml_column_permitted_classes = [Hash, HashWithIndifferentAccess, Time, Symbol]
|
||||
|
||||
# We use this in development-mode only (see development.rb)
|
||||
config.active_record.use_schema_cache_dump = false
|
||||
|
||||
@ -23,4 +23,15 @@ describe PostRevision do
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it "can serialize and deserialize symbols" do
|
||||
# Plugins may store symbolized values in this column
|
||||
pr = Fabricate(:post_revision, modifications: { key: :value })
|
||||
pr.reload
|
||||
expect(pr.modifications).to eq(
|
||||
{
|
||||
key: :value
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user