5

Sometimes I update my Coffee code in Rails 3.1 and it doesn't detect any of the changes, ie. I refresh my browser/cache and it still invokes the old script. Anyone know what causes this?

EDIT: I even litter my entire scripts with "debugger" and none of them ever gets called. Any idea why it simply won't refresh the Coffeescripts?

EDIT2: I realize that it doesn't even detect javascript changes sometimes. Am I missing something? Note I am not bouncing my server when I change JS files... It used to work...

kidcapital
  • 5,064
  • 9
  • 46
  • 68

3 Answers3

6

For the development environment you could try to rake assets:clean. Rails sometimes reads the precompiled assets in development environment, so this will clean them and the fresh ones will be loaded.

For the production environment try to rake assets:precompile, so that the changes are compiled and stored in the assets files.

Ion Br.
  • 2,598
  • 1
  • 19
  • 25
2

For the curious, it suddenly started functioning correctly again by itself. I have reason to believe it was actually the Daylight Savings Time that caused this bug. Not sure if this could be the case but it suspiciously started working again naturally after a fixed amount of time (about 1 hour).

kidcapital
  • 5,064
  • 9
  • 46
  • 68
  • Could be coincidence, but I'm having this problem the morning after DST ended. – Zubin Apr 06 '13 at 22:04
  • The problem has gone away - appears that DST causes coffeescript compiler to cache when it shouldn't. – Zubin Apr 06 '13 at 23:42
0

Try rake assets:precompile, if you haven't already.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
songz
  • 2,082
  • 1
  • 14
  • 18