Created
July 9, 2010 13:18
-
-
Save masqita/469445 to your computer and use it in GitHub Desktop.
Revisions
-
masqita renamed this gist
Jul 9, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
masqita created this gist
Jul 9, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ # In /lib/foo_bar_middleware.rb class FooBarMiddleware def initialize(app, options={}) @app = app # options will be {:foo => :bar} if you look lower down, you can use this in other methods etc @options = options end def call(env) request = ::Rack::Request.new(env) @cookies = request.cookies @app.call(env) end end # In environment.rb: config.middleware.insert_before(ActionController::Session::CookieStore, 'FooBarMiddleware', {:foo => :bar})