5

I am working on some plugin on redmine (project management web application written using Ruby on Rail).

For every change i make to the code of the plugin(say view.html.erb file), i have to restart the redmine(application) server. This is because, it runs on production mode by default.

Will running the application on development mode, solve this problem?

If yes, how can i change its running mode or over-ride this behavior so that classes are loaded per every request (yes this will not be efficient but will be good for development) and changes to the code reflect without restarting the application application server(redmine in this case)

I tried adding this line to environment.rb file

ENV['RAILS_ENV'] ||= 'development'

Also tried answers/comments posted below, but they did'nt solve my problem.

Any working solution would be of great help.

Thank You.

Other Related information:

It uses Rails 2.3.14 and its installed using bitnami stack

hitesh israni
  • 1,742
  • 4
  • 25
  • 48
  • Have you go through [How can I force my plugin to reload with each request?][1] [1]: http://stackoverflow.com/questions/4713066/how-can-i-force-my-plugin-to-reload-with-each-request – Hardik Patel Apr 05 '12 at 10:43
  • @Hardik bhai, i will go through it and comment. thnx for replying. – hitesh israni Apr 05 '12 at 10:59

1 Answers1

4

For automatic plugin reload on Rails 2.3:

Add config.reload_plugins = true on config/environment.rb. It has to be there, you can't put it on config/environments/development.rb due to the Rails start up steps. You may add if RAILS_ENV = 'development' instead.

config/environment.rb

config.reload_plugins = true  

On the plugin's init.rb, add the following line: init.rb

ActiveSupport::Dependencies.explicitly_unloadable_constants = 'YourPluginModuleName' 

That's all. Don't forget to remove it when you're done.

alony
  • 10,725
  • 3
  • 39
  • 46
  • thnx for your response.. just a quick question- is the 'MyPluginModuleName' same as that is in _helper.rb file?? also i am not adding anything in config/environments/development.rb, i have put those lines in config/environment.rb only – hitesh israni Feb 15 '12 at 13:13
  • I assume you plugin is a module, like `module BacklogsPlugin`. So, you need to put as 'MyPluginModuleName' - all the modules you want to reloaded automatically – alony Feb 15 '12 at 13:23
  • well thnx for your quick comment.. also how to run redmine core itself on auto reload mode.. say I changed some code in redmine and now the effect of this changed code should be reflected just on a page refresh, rather than restarting the redmine server?? – hitesh israni Feb 15 '12 at 13:33
  • that should be the default behaviour in the development mode, anyway that is a `config.cache_classes = false` in config/development.rb – alony Feb 15 '12 at 13:36
  • do you want Rails not to cache your classes in production? – alony Feb 15 '12 at 13:46
  • i want those settings only when in development mode.. in production(i mean on live or deployed mode) it should work as its working right now.. in other words when i am making some changes i want redmine to run on auto reload mode.. and when it needs to be deployed back i would want to restore those settings.. hope i am making sense and i am able to explain my question.. thnx a lot.. :) – hitesh israni Feb 15 '12 at 13:53
  • have you gone through http://stackoverflow.com/questions/4713066/how-can-i-force-my-plugin-to-reload-with-each-request ? – Hardik Patel Apr 05 '12 at 10:44