What is the best place to put code for additional context in Rails?

I would like to add additional context in my Ruby on Rails application as explained here.
Where would you suggest to add the code?

1 Like

You probably want to put context into a controller filter:

class ApplicationController < ActionController::Base
  before_action :set_user_context
  def set_user_context
    Raven.user_context(id: current_user.id) #etc