Skip to content

Instantly share code, notes, and snippets.

@lylo
Last active December 17, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lylo/5663750 to your computer and use it in GitHub Desktop.
Save lylo/5663750 to your computer and use it in GitHub Desktop.
Rails 3/3.2 mashalling
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