Class: Decidim::Lausanne::Budgets::CurrentUserRecordMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/lausanne/budgets/current_user_record_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ CurrentUserRecordMiddleware

Returns a new instance of CurrentUserRecordMiddleware.



5
6
7
# File 'lib/decidim/lausanne/budgets/current_user_record_middleware.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
# File 'lib/decidim/lausanne/budgets/current_user_record_middleware.rb', line 9

def call(env)
  request = ActionDispatch::Request.new(env)
  env["decidim_current_user_record"] = request.cookie_jar.encrypted["decidim_current_user_record"].to_i || nil
  @app.call(env)
end