1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Merge pull request #39759 from kamipo/marshal_load_legacy_ar_object"

This reverts commit 4fe1452534, reversing
changes made to 0f4258f646.

That is to prevent the "uninitialized constant" error when loading the
data marshalized by the previous version of Rails (Rails 6.0), it is not
needed for the future version of Rails.

See #39759.

I've added the constant alias in that time, but we usually don't
guarantee the marshalized object compatibility.
This commit is contained in:
Ryuta Kamizono 2021-02-18 17:13:41 +09:00
parent 0e35e670b2
commit 7b4efda97a
3 changed files with 0 additions and 19 deletions

View file

@ -839,10 +839,6 @@ module ActiveRecord
full_version_string.match(/^(?:5\.5\.5-)?(\d+\.\d+\.\d+)/)[1]
end
# Alias MysqlString to work Mashal.load(File.read("legacy_record.dump")).
# TODO: Remove the constant alias once Rails 6.1 has released.
MysqlString = Type::String # :nodoc:
ActiveRecord::Type.register(:immutable_string, adapter: :mysql2) do |_, **args|
Type::ImmutableString.new(true: "1", false: "0", **args)
end

View file

@ -1301,21 +1301,6 @@ class BasicsTest < ActiveRecord::TestCase
assert_equal 1, post.comments.length
end
if current_adapter?(:Mysql2Adapter)
def test_marshal_load_legacy_6_0_record_mysql
path = File.expand_path(
"support/marshal_compatibility_fixtures/legacy_6_0_record_mysql.dump",
TEST_ROOT
)
topic = Marshal.load(File.read(path))
assert_not_predicate topic, :new_record?
assert_equal 1, topic.id
assert_equal "The First Topic", topic.title
assert_equal "Have a nice day", topic.content
end
end
if Process.respond_to?(:fork) && !in_memory_db?
def test_marshal_between_processes
# Define a new model to ensure there are no caches