title: In Rails, how does one access controller data in the model
body: <h2>Scenario</h2>
  <p>I have an application in which I would like events logged to a third party (via a custom module leveraging <a href="https://github.com/hybridgroup/gabba" rel="nofollow noreferrer">Gabba</a> mixed in to my models). The events are generated in the model, but the server side code to generate the events require access to current request's cookies.</p>
  <h2>MVC Problem</h2>
  <p>This is a specialization of the problem where the model needs data that's contained by the controller. Staying true to MVC, the model should not have access to the controller. The answer I've seen used is to pass the values needed as arguments to the model.
  While I agree with that approach in most cases, I don't think it's the best solution here because in general it's unknown and isn't the concern of the controller if the model is going to generate an event.</p>
  <h3>So for a concrete example:</h3>
  <p>Imagine a 'User' model has a static method called 'create'. The UsersController calls the create method with the user hash. The create method wants to publish a &quot;user created&quot; event to Gabba, but wants needs to resolve the google analytics cookies for the current request.
  <strong>It just doesn't seem right to send cookies to User#create</strong>.</p>
  <h3>What I've thought of is:</h3>
  <ol>
  <li>Put the cookie values needed by the metrics module in some sort of global data store that is accessible by the models. (Where would be the best place?)</li>
  <li>Put the events in some sort of store, and have the controller run the event code at the end of processing the request.</li>
  </ol>