rails/rails — pull request #8017 by jcoglan (2012-10-23 19:20:31+00:00)
Title: Store FlashHashes in the session as plain hashes rather than custom obje..

As stated here, changing the implementation of FlashHash can break people's sessions.

https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/flash.rb#L73-76

This happened between Rails 2 and 3, and the ivars have again changed since 3.2, for example replacing `@used` with `@discard`.

So, this patch avoids this issue altogether by mapping the flash object onto a simple data structure for storage in the session. The intention is that this representation remain stable while still allowing the implementation to change, without invalidating existing sessions.