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

**URL:** <https://www.ruby-forum.com/t/why-does-rails-generate-random-numbers-thing-1194897572/120103>\
**Category:** Rails\
**Created:** [November 13, 2007, 8:09pm UTC](https://www.ruby-forum.com/t/why-does-rails-generate-random-numbers-thing-1194897572/120103 "2007-11-13T20:09:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredistic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a8b319/32.png) [@fredistic](https://www.ruby-forum.com/u/fredistic)\
**Post date:** [November 13, 2007, 8:09pm UTC](https://www.ruby-forum.com/t/why-does-rails-generate-random-numbers-thing-1194897572/120103/1 "2007-11-13T20:09:06Z")

</div>

Rails generated:  
 ![Mediumg](https://test.ruby-forum.com/images/Art/mediumg.png?%0A1194897572)

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.

* * *

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.

fredistic

---

<div class="post-metadata">

**Author:** ![fredistic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a8b319/32.png) [@fredistic](https://www.ruby-forum.com/u/fredistic)\
**Post date:** [November 13, 2007, 8:17pm UTC](https://www.ruby-forum.com/t/why-does-rails-generate-random-numbers-thing-1194897572/120103/2 "2007-11-13T20:17:18Z")

</div>

On 11/13/07, fredistic [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Rails generated:  
> ![Mediumg](https://www.ruby-forum.com/images/Art/mediumg.png?%201194897572)
> 
> 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

---

<div class="post-metadata">

**Author:** ![fredistic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a8b319/32.png) [@fredistic](https://www.ruby-forum.com/u/fredistic)\
**Post date:** [November 13, 2007, 9:14pm UTC](https://www.ruby-forum.com/t/why-does-rails-generate-random-numbers-thing-1194897572/120103/3 "2007-11-13T21:14:09Z")

</div>

[http://blog.hypsometry.com/archives/2006/5/18/on\_browser\_caching\_asset\_timestamping/](http://blog.hypsometry.com/archives/2006/5/18/on_browser_caching_asset_timestamping/)

> **[New requirement for img tags? ( like ) - HTML / CSS](https://bytes.com/topic/html-css/answers/500324-new-requirement-img-tags-like-img-src)**
>
> New requirement for img tags? ( like \<img src=... /\> ). HTML / CSS Forums on Bytes.

---

<div class="post-metadata">

**Author:** ![fredistic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a8b319/32.png) [@fredistic](https://www.ruby-forum.com/u/fredistic)\
**Post date:** [November 16, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/why-does-rails-generate-random-numbers-thing-1194897572/120103/4 "2007-11-16T17:20:47Z")

</div>

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:

something

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
