Re: Reloading controller plugins on each request

Frederick Cheung
Mon, 12 Apr 2010 08:08:22 -0000

On 12 Apr, 04:03, Nick <n...-qGbiljoI0DQkmLvzuZlaBw@public.gmane.org>
wrote:
> On Apr 11, 6:26 pm, Frederick Cheung
<frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> wrote:
>
> > If you want something to be reloadable you should use
> > require_dependency to load it. The main thing though is that a
> > plugin''s init.rb is not re-run between requests, so the
include you do
> > on ApplicationController is lost after the first request.
>
> > Fred
>
> Right. So how can one get a module included in a controller on
> subsequent requests without explicitly putting an #include in the
> controller?
>
> To facilitate development (IE: not restart WEBrick between requests),
> I have this at the moment:
>     class DashboardsController < ApplicationController
>       include ActsAsDashboard
>       acts_as_dashboard
>
> I''d like to figure out how to remove that #include . Any ideas?

I suppose you could define self.inherited on ActionController::Base
and do your setup from there.

Fred