Skip to content

Conversation

aidanharan
Copy link
Contributor

Fixed the association dumps so that the replies were loaded before marshaling. Used following code to create the dumps:

ActiveRecord::Marshalling.format_version = 6.1
topic = Topic.find(1)
topic.replies.load
File.binwrite(marshal_fixture_path("rails_6_1_topic_associations"), Marshal.dump(topic))

ActiveRecord::Marshalling.format_version = 7.1
topic = Topic.find(1)
topic.replies.load
File.binwrite(marshal_fixture_path("rails_7_1_topic_associations"), Marshal.dump(topic))

Fixes tests:

  • MarshalSerializationTest#test_deserializing_rails_7_1_marshal_with_loaded_association_cache
  • MarshalSerializationTest#test_deserializing_rails_6_1_marshal_with_loaded_association_cache

To create the dumps with associates use:

ActiveRecord::Marshalling.format_version = 6.1
topic = Topic.find(1)
topic.replies.load
File.binwrite(marshal_fixture_path("rails_6_1_topic_associations"), Marshal.dump(topic))

ActiveRecord::Marshalling.format_version = 7.1
topic = Topic.find(1)
topic.replies.load
File.binwrite(marshal_fixture_path("rails_7_1_topic_associations"), Marshal.dump(topic))
@aidanharan aidanharan marked this pull request as ready for review October 12, 2023 10:53
@aidanharan aidanharan merged commit d9c3c44 into main Oct 12, 2023
@aidanharan aidanharan deleted the load-replies-in-dumps branch October 12, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant