Hi,
I've finally found a solution for reloading classes found in rails' lib folder.
In Environment.rb: Add the path for the lib subdirectory where my module was stored, e.g.
config.load_paths += %W( #{RAILS_ROOT}/lib/item_setup )
In Development.rb: Add the name of my Module to the explicitly_unloadable_constants list, e.g.,
ActiveSupport::Dependencies.explicitly_unloadable_constants = 'NameOfMyModule'
If you have other modules you want to automatically reload, use the << explicitly_unloadable_constants array, e.g.,
ActiveSupport::Dependencies.explicitly_unloadable_constants << 'NameOfAnotherModule'
That's more less it.
No comments:
Post a Comment