Class: FlashPatch::Rails30SessionLoader
- Inherits:
-
Object
- Object
- FlashPatch::Rails30SessionLoader
- Defined in:
- lib/flash_patch/rails_3_0_session_loader.rb
Instance Method Summary collapse
-
#initialize(decrypted_session_string) ⇒ Rails30SessionLoader
constructor
A new instance of Rails30SessionLoader.
- #load_session ⇒ Object
Constructor Details
#initialize(decrypted_session_string) ⇒ Rails30SessionLoader
Returns a new instance of Rails30SessionLoader.
3 4 5 |
# File 'lib/flash_patch/rails_3_0_session_loader.rb', line 3 def initialize(decrypted_session_string) @decrypted_session_string = decrypted_session_string end |
Instance Method Details
#load_session ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/flash_patch/rails_3_0_session_loader.rb', line 7 def load_session # From trial-and-error, we can change one letter in the name of # class in the Marshal-dumped string. So, we can call the backport # class FlashGash and use gsub so that Marshal will load the Rails 3.0 session # hash using it session = Marshal.load @decrypted_session_string.gsub('FlashHash','FlashGash') = session.delete('flash') session['flash'] = ActionDispatch::Flash::FlashHash.new.update() session end |