lorm
lorm

Reputation: 3361

Unable to clear Rails cache and see an updated template

The previous programmer suddenly quit. They left no documentation about a Rails app they spent a year developing. I have now been given the task of making some changes. But I can not make changes to a template appear in the production site, if I ssh to the server and edit the templates in production.

The system:

  rake about

  Rails version             4.2.0
  Ruby version              2.2.3-p173 (x86_64-darwin15)
  RubyGems version          2.4.5.1
  Rack version              1.5
  JavaScript Runtime        Node.js (V8)
  Environment               development
  Database adapter          mysql2

I think the problem is the cache, but I tried:

  rake tmp:cache:clear

and:

  Rails.cache.clear

with no visible effect.

I am nervous about restarting the app since I have no instructions about how to start it. I am unsure of whether there are Cap scripts that are up to date.

On my machine, if I edit:

 apps/views/layouts/application.html.erb

then I see the change instantly, but if I ssh to production and make the same change, I don't see the change. There are some pages where I can edit their HTML template, and I see the changes right away, but not application.html.erb.

Assuming this problem is the cache, how should I clear the cache?

Upvotes: 1

Views: 1149

Answers (1)

Jacob Rastad
Jacob Rastad

Reputation: 1171

In this case, it's most likely not a caching problem.

In production mode, all classes etc. are preloaded during the startup of the app. Ergo you must restart the server when making changes to anything in your Rails app.

When you SSH to your server and type

$ ps auxf

You should be able to see the flags used when starting the app previously.

Upvotes: 1

Related Questions