Created
July 9, 2010 13:18
-
-
Save masqita/469445 to your computer and use it in GitHub Desktop.
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 characters
# 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}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment