[Rails] Re: Reloading controller plugins on each request

2010-04-12 Thread Frederick Cheung
On 12 Apr, 04:03, Nick wrote: > On Apr 11, 6:26 pm, Frederick Cheung > 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 Applicat

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Nick
On Apr 11, 6:26 pm, Frederick Cheung 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.

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Frederick Cheung
On Apr 11, 7:42 pm, Nick wrote: > > However, every request other than the first results in this error: >     "undefined local variable or method `acts_as_dashboard' for > DashboardsController:Class" > citing line 2 of app/controllers/dashboards_controller.rb : >     1 class DashboardsController

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Nick
On Apr 11, 2:42 pm, Nick wrote: > Hey Frederick. Thanks for the tip. That makes sense. It turns out that > I didn't completely solve the problem of the plugin reloading, and I > think what you described is the culprit. > > For some reason, ActsAsDashboard::ClassMethods is not being reloaded > for

[Rails] Re: Reloading controller plugins on each request

2010-04-11 Thread Nick
Hey Frederick. Thanks for the tip. That makes sense. It turns out that I didn't completely solve the problem of the plugin reloading, and I think what you described is the culprit. For some reason, ActsAsDashboard::ClassMethods is not being reloaded for each request. I tried your suggestion of ch

[Rails] Re: Reloading controller plugins on each request

2010-04-10 Thread Frederick Cheung
On Apr 10, 4:38 pm, Nick wrote: > > On Apr 10, 11:06 am, "kel...@gmail.com" wrote: > > > Did you try require_dependency instead of require? > > I've never heard of require_dependency. I just gave it a try, but > unfortunately, all requests but the first result in this error: > > "A copy of Act

[Rails] Re: Reloading controller plugins on each request

2010-04-10 Thread Nick
On Apr 10, 11:38 am, Nick wrote: > Is there a way to configure Rails to reload the plugin for each request? > > Here's the code:http://gist.github.com/361804 The answer's dead easy. Those child modules and classes need to split out into separate files. So ActsAsDashboard::Config must be in lib/ a

[Rails] Re: Reloading controller plugins on each request

2010-04-10 Thread Nick
> > Is there a way to configure Rails to reload the plugin for each request? > > > Here's the code:http://gist.github.com/361804 > > > Thanks! > > Nick On Apr 10, 11:06 am, "kel...@gmail.com" wrote: > Did you try require_dependency instead of require? I've never heard of require_dependency. I ju

[Rails] Re: Reloading controller plugins on each request

2010-04-10 Thread kel...@gmail.com
Did you try require_dependency instead of require? > Is there a way to configure Rails to reload the plugin for each request? > > Here's the code:http://gist.github.com/361804 > > Thanks! > Nick -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"