Markus SvennerstÃ¥l wrote:
I’ve just found myself in charge of maintaining and developing a rails
web application at my company. It’s a newbish question as I have pretty
much no experience with rails before. The problem is that although I
change a model file, app/models/template.rb, the web application doesn’t
update with the change. In fact, nothing I do to the file seems to
affect the application - I even moved it to a different directory, and
the application still behaves as before.
The application runs with the memcached and the acts_as_cached plugin,
but that particular model file isn’t specified to be cached. So, any
tips how I can make my changes to the model file apply to the
If you are modifying the application in production, the model class
won’t be reloaded unless you stop and restart the server. In the
development configuration of the Rails environment, model classes (and
many others) are automatically reloaded when they change.
Now, if you are modifying the application code on the production server,
you have a whole other mess of problems to deal with. You really need to
study up on best practices for server development and maintenance. At a
minimum you need to develop on a machine that isn’t your production
server, store your code in a versioned repository such as Subversion,
and deploy only a tested revision to production. Anything less is
eventually going to end up with you in a lot of pain.
If you are already doing allnthat, then perhaps your development
environment somehow thinks it is a production one. Look in
config.environment.rb near the top of the file and see if the line
ENV[‘RAILS_ENV’] ||= ‘production’
is active. Commenting it out might fix things for you. If that doesn’t
help, maybe you are using a script that is setting RAILS_ENV to
production. Or the previous developer may have hacked the code in some
way that disables class reloading. In the file
config/environments/development.rb, there should be a line that says
config.cache_classes = false
If that isn’t there or sets it to true, fix it.