Is there a way to reload everything on each request. I’m working with a
lot of lib and vendor/plugin files, and in development mode i’d like to
have all of those reloaded.
I used to have a couple of methods that worked in rails < 2.1 but they
are no longer working.
Is there a way to reload everything on each request. I’m working with a
lot of lib and vendor/plugin files, and in development mode i’d like to
have all of those reloaded.
I used to have a couple of methods that worked in rails < 2.1 but they
are no longer working.
Is there a way to reload everything on each request. �I’m working with a
lot of lib and vendor/plugin files, and in development mode i’d like to
have all of those reloaded.
I used to have a couple of methods that worked in rails < 2.1 but they
are no longer working.
Whatever I do I still can not reload the plugin, the plugin is
definitely not in the load once paths. My init.rb just contains 4
requires but nothing besides that.
I’ve googled, nobody else seems to be having this issue.
I ran into the same problem; turned out that I also had to add the
module which contains my plugin’s classes to
ActiveSupport::Dependencies.explicitly_unloadable_constants
and then declare a module (or a class) called Myplugin in lib/
myplugin.rb (otherwise Rails would give me errors about expecting this
file to declare a class with that name)
For some reason scoping Dependencies in the ActiveSupport module doesn’t
work. Also after I add the explicitly_unloadable_constants, the module
is no longer available in the controller. (I suppose this could be
because the plugin has the same name as the module?
Ingmar wrote:
I ran into the same problem; turned out that I also had to add the
module which contains my plugin’s classes to
ActiveSupport::Dependencies.explicitly_unloadable_constants
and then declare a module (or a class) called Myplugin in lib/
myplugin.rb (otherwise Rails would give me errors about expecting this
file to declare a class with that name)
It might be a name-convention issue… If your module/class is called
‘ActiveExt’ then the corresponding .rb file should be named
active_ext.rb (without the underline, it corresponds to the class
‘Activeext’ without the capital E)
Try to either rename your model or your files accordingly. Make sure
that you’re running the latest version of Rails (I’m using 2.1.1 atm)
which encourages you to use ActiveSupport::Dependencies rather than
just Dependencies btw.
You may also create a new project and try it with a non-brainer-plugin
first, like a class that only has one method throwing a certain
string. You should be able to access that class from within your
controller without adding another ‘require’ command (the one from
init.rb should be sufficient).
One more thing (sorry for the verbose reply) - if you’re adding
functionality to some of Rails’ modules and classes like for example
ActiveRecord, you might be out of luck. As far as I understand it,
these are generally not being reloaded although there may still be
some tricks I don’t know of.
Dependencies is only inside the activesupport namespace in edge. Even
if a plugin is marked as reloadable it’s init.rb won’t get reloaded as
far as I know - it just controls whether the constants are removed
after requests
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.