No commit activity in last 3 years
No release in over 3 years
Rack::FlashSession converts a session query parameter to a cookie if the request's user agent is flash. http://github.com/bartt/rack-flash-session
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.1
>= 0.5.3
>= 1.3.0

Runtime

>= 1.0
 Project Readme

Install¶ ↑

$ gem install rack-flash-session

Rails¶ ↑

# config/environment.rb
config.gem 'rack-flash-session', :lib => 'rack/flash-session'
config.middleware.insert_before(ActionController::Base.session_store, 'Rack::FlashSession');

Middleware¶ ↑

# add a use line to your builder
require 'rack/flash-session'
Rack::Builder.new do
  use Rack::FlashSession
  run MyApp.new
end

Options¶ ↑

The default session key is ‘_session_id’ but you can specify your own:

use Rack::FlashSession, 'sid'

Or in Rails you can reference the key defined to be used as session key:

config.middleware.insert_before(ActionController::Base.session_store, 'Rack::FlashSession', config.action_controller.session[:key])

Note that the session key is used for both the query parameter name and the cookie name.

You can specify multiple session keys:

use Rack::FlashSession, 'sid', 'my_other_session_key'

Thanks to:¶ ↑

Rob Anderton for posting Flash uploaders, Rails, cookie based sessions and CSRF: Rack Middleware to the rescue! (thewebfellas.com/blog/2008/12/22/flash-uploaders-rails-cookie-based-sessions-and-csrf-rack-middleware-to-the-rescue) on which this gem is based.