I'm trying to move some of my application's code into a plugin,
specifically the part that deals with web analytics. Some of the
features allow the controller to fire events that get displayed in the
views as JS code through a partial or helper. I'm currently doing this
with instance variables, but when I move it to a class or instance
variable of my plugin class, it persists between requests. I guess
this makes sense because the plugin is loaded on startup.
What I have working is making it an instance variable of
which is cleared on every request. It works, but I feel like I'm
working against the grain here and doing something wrong.
Is what I'm doing OK, or is there a better way? To make it clear, I
want to be able to do something like "notice_event('blah')" in the
controller of the main application, and have the plugin's helper know
about "blah" for the current request, but not the next request.