File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ module ActiveType
22 module Marshalling
33 # With 7.1 rails defines its own marshal_dump and marshal_load methods,
44 # which selectively only dump and load the record´s attributes and some more stuff, but not our @virtual_attributes.
5- # Wherever these new methods are actually used, depends on ActiveRecord::Marshalling.format_version
5+ # Whether these new methods are actually used, depends on ActiveRecord::Marshalling.format_version
66 # For format_version = 6.1 active record uses the default ruby implementation for dumping and loading.
77 # For format_version = 7.1 active record uses a custom implementation, which we need to override.
88 #
@@ -17,7 +17,7 @@ module Marshalling
1717 # * A custom marshal_load is only used, when marshal_dump is also defined. So we can keep marshal_dump always defined.
1818 # (If either is missing, ruby will use _dump and _load)
1919 # * If a serialized object is dumped using _dump it will be loaded using _load, never marshal_load, so a record
20- # serialized with format_version = 6.1 using _dump, will always load using _load, ignoring wherever marshal_load is defined or not.
20+ # serialized with format_version = 6.1 using _dump, will always load using _load, ignoring whether marshal_load is defined or not.
2121 # This ensures objects will always be deserialized with the method they were serialized with. We don´t need to worry about that.
2222
2323 class << self
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class Object < ActiveRecord::Base
1010 include NoTable
1111 include VirtualAttributes
1212 include NestedAttributes
13- include Marshalling ::Methods if defined? ( Marshalling :: Methods )
13+ include Marshalling ::Methods if ActiveRecord :: VERSION :: MAJOR >= 7 && ActiveRecord :: VERSION :: MINOR >= 1
1414
1515 end
1616
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class Record < ActiveRecord::Base
1414 include NestedAttributes
1515 include RecordExtension
1616 include ChangeAssociation
17- include Marshalling ::Methods if defined? ( Marshalling :: Methods )
17+ include Marshalling ::Methods if ActiveRecord :: VERSION :: MAJOR >= 7 && ActiveRecord :: VERSION :: MINOR >= 1
1818
1919 end
2020
You can’t perform that action at this time.
0 commit comments