Git Product home page Git Product logo

rails_4_session_flash_backport's Introduction

Rails4SessionFlashBackport

Different versions of Rails have stored flash messages in different objects in the session, making it a pain to upgrade without nuking everyones session. The good ol' ActionDispatch::Session::SessionRestoreError making life difficult.

This gem was created because we wanted to be able to keep our users Rails 2 sessions working on Rails 3, and we figured as long as we're going to be doing crazy stuff we might as well go and use the far more sensible practice from Rails 4 of storing the flash as basic ruby types.

When using this gem on a Rails 2 or 3 app:

  • Flash messages are stored as basic objects in the Rails 4 style.
  • Flash messages in the Rails 2 format can be successfully decoded.
  • Flash messages in the Rails 3 format can be successfully decoded.
  • Flash messages in the Rails 4 format can be successfully decoded.

Additionally, on Rails 2 we include some patches for the SessionHash and CookieStore, in order to make them act more like their HashWithIndifferentAccess versions on Rails 3, so that your session_id can survive a trip to Rails 3 and back.

This actually makes it possible to bounce requests from a Rails 2 server, to a Rails 3 server and back again so long as both servers are using this gem. Very helpful when you're doing a big Rails 2 => 3 upgrade and want to run a few Rails 3 servers concurrently with your Rails 2 cluster to verify everything is fine and performance is acceptable without having to do the all-in switch.

Installation

Add this line to your application's Gemfile:

gem 'rails_4_session_flash_backport'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rails_4_session_flash_backport

Copyright

Copyright (c) 2012 Envato, Lucas Parry, chendo. See LICENSE.txt for further details.

rails_4_session_flash_backport's People

Contributors

lparry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.