Last active
December 17, 2015 19:58
-
-
Save lylo/5663750 to your computer and use it in GitHub Desktop.
Rails 3/3.2 mashalling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def initialize(a) | |
@a = a | |
end | |
end | |
d = Marshal.dump(Foo.new(1)) | |
=> "\x04\bIC:\bFoo{\x00\x06:\a@ai\x06" | |
Marshal.load("\x04\bIC:\bFoo{\x00\x06:\a@ai\x06") | |
# => works | |
# restart the console | |
class Foo < Hash | |
def initialize(a) | |
@a = a | |
end | |
end | |
Marshal.load("\x04\bIC:\bFoo{\x00\x06:\a@ai\x06") | |
# => blows up with error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment