Home Rails 4 set session inside of Middleware
Reply: 0

Rails 4 set session inside of Middleware

user506
1#
user506 Published in August 15, 2018, 5:36 am

I am trying to set up a session on a middleware but it says that NameError: undefined local variable or method 'session' for.

class Middleware::GlobalSite
  def initialize(app)
    @app = app
  end

  def call(env)
    @status, @headers, @response = @app.call(env)

    if /global/.match(env['HTTP_REFERER']).present?
      session[:global] = true
    end

    [@status, @headers, @response]
  end
end

Can someone help me with? Thanks a lot.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.298656 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO