Are Radiant custom extension controllers, models, etc. supposed to reload between each request like regular Rails objects in development mode or not? I thought they did, but I'm not seeing mine reload. Thanks, Wes
on 2010-10-24 23:24
on 2010-10-25 16:04
On Oct 24, 2010, at 5:24 PM, Wes Gamble wrote:
> Are Radiant custom extension controllers, models, etc. supposed to reload
between each request like regular Rails objects in development mode or not?
Rails sees Radiant extensions as plugins, not engines or native
application entities. They won't get reloaded unless you take steps to
make it happen. If you take a look at the PageFactory extension, I'm
doing something along those lines:
Dir["#{path}/*_page_factory.rb"].each do |page_factory|
if page_factory =~ %r{/([^/]+)\.rb}
require_dependency page_factory
ActiveSupport::Dependencies.explicitly_unloadable_constants <<
$1.camelize
end
end
I'm 1) registering my own classes with ActiveSupport's dependency
mechanism, and 2) telling ActiveSupport that these need to get reloaded
between requests.
Hope that helps,
j
on 2010-10-25 16:07
I'm a novice at extension authoring, but in my experience the code gets reloaded every second refresh. No explanation why that'd be (Chrome + 0.9.1 + Mongrel), but it works for me. - Jeff
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.