On Apr 11, 2:42 pm, Nick [email protected] wrote:
Might you know what needs to be done to get Rails to reload
ActsAsDashboard::ClassMethods for each request?
Whoops, I sent that last email a bit prematurely. After switching to
ApplicationController.send :include, ActsAsDashboard
in init.rb , this error:
undefined local variable or method `acts_as_dashboard’ for
was occuring on subsequent requests because init.rb is only run when
the web server is started; it isn’t run before any web requests.
So on the first request, ActsAsDashboard has been loaded, and life’s
peachy. But on the 2nd request, all of those non-Rails framework
classes (such as ApplicationController, DashboardsController, etc) are
unloaded and then loaded. However, because my init.rb isn’t executed,
ActsAsDashboard isn’t included into ApplicationController. Thus,
#acts_as_dashboard isn’t available to DashboardsController, and the
error above occurs.
I’ve found that putting
into DashboardsController gets rid of the error above, and results in
ActsAsDashboard::ClassMethods being reloaded for each request.
However, that’s only a short-term solution.
Does anyone know what the proper fix is for this?