Draconis Software Blog

Remote editing Ruby code and timestamps

This is a programming quickie, but can be one of those gotchas if you don’t know what to look for. As I mentioned recently, I had to temporarily switch back to the Windows side of things when my MacBook died, and in doing, had to learn new tools for getting my work done. One of those tools was to replace Cyberduck, which I used to open a remote connection (via SFTP) to edit files live. Well, I was recently working on a Ruby on Rails project, and I noticed a strange side effect: whenever I would edit a file (a view, controller, etc), and hit reload in my browser, I never noticed the change. It could be the simplest or most complex, but it never seemed to appear unless I restarted Mongrel.

Turns out the problem was actually quite simple: WinSCP, the replacement I was using for Cyberduck, was set to preserve timestamps on files by default. Mongrel checks timestamps of files to determine whether to reload them live (in development mode, mind you, where I wasn’t doing any caching), and these timestamps need to be changed by WinSCP in order to show up to Mongrel.

To fix the problem, just click the Preferences icon in WinSCP, click the Transfer selection on the left, then uncheck the “Preserve timestamp” option under Common options. This should now update timetamps correctly and your changes should appear to Mongrel. Enjoy.

Share and Enjoy:
  • Digg
  • Reddit
  • Ma.gnolia
  • del.icio.us
  • BlogMemes
  • Facebook
  • Mixx
  • Furl
  • Google
  • TwitThis
  • Spurl
  • LinkedIn
  • Propeller
  • E-mail this story to a friend!