-
Notifications
You must be signed in to change notification settings - Fork 23
Support custom serialization for Session::CookieStore #64
Conversation
Backport for Rails 4 flash hash based on https://github.com/envato/rails_4_session_flash_backport
This also updates the AbstractStore to access hash keys with indifferent access, allowing for serializers that don't support serializing symbol keys. |
Cool. We'll also need to make sure we get these changes into the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we do in the Rails 3.x case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this branch we should only receive a FlashHash (only during transition period) or Hash. I still need to update 3.0 with 3.x specific changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if we're also changing 3.x to use a Rails 4 hash then we don't need to handle it specially here? OK, I see.
🆒 I'm excited to see this happen. I'm wondering though if we could save ourselves some of the string vs sym key difficulties by using a HashWithIndifferentAccess? |
Alternatively, |
I thought about this, but appears that upstream Rails 4 has indifferent access but does not use HashWithIndifferentAccess: https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/flash.rb. I have tried to stay consistent with upstream in f46a4ba. |
🆒 On Tue, Apr 29, 2014 at 5:23 PM, Greg Ose [email protected] wrote:
-Ben Toews |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above you are prefer the to_s
ones, but here you prefer the non to_s
one.
Upstream doesnt support nested hashes having indifferent access, we should stay consistent. Swap order for returned value in session hash.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@charliesome i dont think you bumped this last change
Support custom serialization for Session::CookieStore
This change provides the ability to specify a custom serializer for the CookieStore. In order to use serializers which only support base types, the FlashHash object has to support (de)serialization to/from plain Ruby hashes. FlashHash changes were made by porting over the Rails 2 portions of Envato's Rails 4 flash backport, h/t @charliesome .
/cc @josh @mastahyeti @ptoomey3 @dbussink