# Problem with link tags

**URL:** <https://www.ruby-forum.com/t/problem-with-link-tags/82314>\
**Category:** Rails\
**Created:** [January 19, 2007, 10:27am UTC](https://www.ruby-forum.com/t/problem-with-link-tags/82314 "2007-01-19T10:27:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![migrate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@migrate](https://www.ruby-forum.com/u/migrate)\
**Post date:** [January 19, 2007, 10:27am UTC](https://www.ruby-forum.com/t/problem-with-link-tags/82314/1 "2007-01-19T10:27:11Z")

</div>

Hell all,  
I have a layout were I add my stylesheets and javascript in the  
following manner:

\<%= stylesheet\_link\_tag “/form” %\>  
\<%= stylesheet\_link\_tag “/text” %\>  
\<%= javascript\_include\_tag :defaults %\>

But what happens is that in the actual web page the source is the  
following:

So Rails is adding some numbers to the links. This breaks my javascripts  
and stylesheets. Can anyone help me?

Thanks.  
Bye,  
Migrate

---

<div class="post-metadata">

**Author:** ![migrate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@migrate](https://www.ruby-forum.com/u/migrate)\
**Post date:** [January 19, 2007, 11:35am UTC](https://www.ruby-forum.com/t/problem-with-link-tags/82314/2 "2007-01-19T11:35:03Z")

</div>

Hu Ma wrote:

> So Rails is adding some numbers to the links. This breaks my javascripts  
> and stylesheets. Can anyone help me?
> 
> Thanks.  
> Bye,  
> Migrate

I believe rails does that to bypass any caching that can break scripts.

It should not break them though. Are you sure your scripts are in the  
correct directory?

---

<div class="post-metadata">

**Author:** ![migrate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@migrate](https://www.ruby-forum.com/u/migrate)\
**Post date:** [January 19, 2007, 3:29pm UTC](https://www.ruby-forum.com/t/problem-with-link-tags/82314/3 "2007-01-19T15:29:50Z")

</div>

askegg \<rails-mailing-list@…\> writes:

> I believe rails does that to bypass any caching that can break scripts.
> 
> It should not break them though. Are you sure your scripts are in the  
> correct directory?

I’ll second this. It shouldn’t break your files at all.

The number is just a timestamp for the last file modification time. It’s  
there  
to ensure that any UA which is sloppy about caching will always get new  
versions  
of the files when they’re updated.

I think the problem is the / in front of your CSS names. This would be  
look for  
the CSS files inside your /public directory, whereas they would normally  
be  
stored in /public/stylesheets.

Using \<% stylesheet\_link\_tag “form” %\> will create a link to  
/stylesheets/form.css which is probably what you’re looking for.

---

<div class="post-metadata">

**Author:** ![migrate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@migrate](https://www.ruby-forum.com/u/migrate)\
**Post date:** [January 19, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/problem-with-link-tags/82314/4 "2007-01-19T16:31:21Z")

</div>

You can set this in environment.rb.

ENV[‘RAILS\_ASSET\_ID’] = “”

This is outside of the Rails::Initializer stuff.

---

<div class="post-metadata">

**Author:** ![migrate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@migrate](https://www.ruby-forum.com/u/migrate)\
**Post date:** [January 19, 2007, 9:21pm UTC](https://www.ruby-forum.com/t/problem-with-link-tags/82314/5 "2007-01-19T21:21:56Z")

</div>

removed\_email\_address@domain.invalid wrote:

> You can set this in environment.rb.
> 
> ENV[‘RAILS\_ASSET\_ID’] = “”
> 
> This is outside of the Rails::Initializer stuff.

Thanks for all your help.  
There’s no problem with the link tags. I found out that it was my fault.  
I had them in the wrong place.

Bye,  
Migrate
