Access Rails 3 Session from Rack?

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-05-10T23:44:05Z Indexed on 2010/05/11 0:24 UTC
Read the original article Hit count: 495

Filed under:
|
|
|

I was able to do the following in Rails 2.3.5 to access attributes that I set on the session from within my Rails app. Now in Rails 3, env["rack.session"] is nil. How do I do the same thing in Rails 3?

class CallbackFilter
  def initialize(app)
    @app = app
  end

  def call(env)
    unless env["rack.session"][:oauth_callback_method].blank?
      env["REQUEST_METHOD"] = env["rack.session"].delete(:oauth_callback_method).to_s.upcase
    end
    @app.call(env)
  end
end

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rails3