In my Rails 3.2 setup I had the following middleware:
@app = app
def call(env) request = Rack::Request.new(env) params = request.params cookies = request.env['action_dispatch.cookies'] session = request.env['rack.session'] requested_locale = params['locale'] || cookies['locale'] || I18n.
session['locale'] = cookies['locale'] = locale @app.call(env) end
It was working fine until I’ve upgraded to Rails 4.0, where
nil and therefore I get the error:
NoMethodError: undefined method `’ for nil:NilClass
cookies['locale'] is called. What’s the proper way to do this in
P.S. Rack also was bumped from 1.4.6 to 1.5.5.