Reputation: 22515
I'm developing a Ruby on Rails app, and everytime I made changes to my class file, I need to restart the server in order for the code changes to be reflected. The code is in my controllers directory, but it's not a controller.
What change do I need to make to make the class reload automatically everytime I make a change? I've set caching to false in my environment config file, and it still doesn't work.
Any ideas?
Upvotes: 1
Views: 7196
Reputation: 3557
I would probably move the code out of the controllers directory (if it isn't a controller it does not belong there) to maybe lib/controller_extensions/ and add this line to my config/application.rb (rails3) or to config/environment.rb (rails 2.3.10)
config.autoload_paths += Dir["#{config.root}/lib/controller_extensions/"]
Upvotes: 4
Reputation: 309
If its the development environment I don't think you have to change the server in order to get the changes made in the controller .Rather If there are any changes made in the Model class then you have to restart the server again.
Upvotes: 2
Reputation: 2604
It really depends on where the classes are originally loaded. Here is a method of reloading what you want in different environments.
Why does code need to be reloaded in Rails 3?
Upvotes: 3