RubyFlow The Ruby and Rails community linklog

Better globals with a tiny ActiveSupport module

In Rails, you might set data once during a request, but use it in every layer of your app. Which user is making the request? What permissions do they have? Using a Ruby global variable or class variable for this would be bad – multiple threads could overwrite it, and you’d end up with a huge mess. Instead, you need something that’s global, but for just that request.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in