I am using Ruby on Rails 3 and I am trying to use middlewares in order to set a variable @variable_name
accessible later in controllers.
For example my midd
You can use 'env' for that. So in your middleware you do this:
def call(env)
env['account'] = Account.find(1)
@app.call(env)
end
You can get the value by using 'request' in your app:
request.env['account']
And please don't use global variables or class attributes as some people suggest here. That's a sure way to get yourself into troubles and really is a bad habit.