Image Uploads - without using file_column

I like file_column… I use it all the time… but what would you rename the files to?

The numbers on the end of the filenameare there because Rails puts them there. Those numbers help ensure that your browser doesn’t cache the image. The numbers are based off of the last modified date of the image… so it will cache until the image changes on disk.

I see where you’re going… but my advice would be to leave it an move on. It may not be the URL you want, but is that really necessary? I’d take the tradeoff instead of reinventing the wheel.

In a few weeks if you really want to change it you could actually change where file_column stores the images… you could then make your own method that uses send_data. That’s how you’d do secure downloads, for example.

you could also look into file_column a bit, you’ll see where the naming takes place. It could be a neat little excercise for you to add an option that modifies where the record is saved. With some Ruby-fu, it could be simple.

Best of luck!