Problem with link tags


#1

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


#2

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?


#3

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.


#4

You can set this in environment.rb.

ENV[‘RAILS_ASSET_ID’] = “”

This is outside of the Rails::Initializer stuff.


#5

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