Why does Rails generate random numbers: thing?1194897572 ??

Rails generated: <img alt="Mediumg" height="160" src="/images/Art/mediumg.png? 1194897572" width="121" />

from: <%= image_tag("/images/Art/mediumg.png", :size => "121x160") %>

The filename is appended with a question mark and a random number. What's it for? It does the same thing on link tags.

Rails generated: <img alt="Mediumg" height="160" src="/images/Art/mediumg.png? 1194897572" width="121" />

from: <%= image_tag("/images/Art/mediumg.png", :size => "121x160") %>

The filename is appended with a question mark and a random number. What's it for? It does the same thing on link tags.

It's the file timestamp; it's appended so that proxies and browsers caches work correctly when a new version of the file is deployed. You can turn it on and off.

Also, is there a way to get Rails to stop generating the trailing slash? I suspect it's harmless but it's not part of HTML.

Nope. This has been discussed here before.

jeremy

http://blog.hypsometry.com/archives/2006/5/18/on_browser_caching_asset_timestamping/

The trailing slash IS part of xhtml. It is harmless in HTML.

that is, tags without an ending in xhtml look like:

  <img ... />

while tags with an ending tag look like:

  <a href=...>something </a>

this is a good thing. It means your code is xhtml (aka xml) and makes parsing it better. I suggest you write to modern standards, not 1990 ones.

--Michael