0

Hi I am very new to RoR and is using Rails 3.2.8 to develop my app. When I am testing my pages, an URL address is automatically displayed after all the links. For instance, <%= link_to 'Home', root_path %> will generate a view in the browser like Home(/), though (/) is not an element that can be found in the page source. I believe this is because I am under development mode? Is there a way to shut this feature off? Thanks!

Here are my codes:

<ul>
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Contact", contact_path %></li>
</ul>

And here is the actual html code generated:

<ul>
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
<li><a href="/contact">Contact</a></li>
</ul>

You can see this is perfectly normal...which makes me believe this is not a coding problem. However, when comes into the browser, it is displayed as

I do wish to know where the (/url) part come from... And how to get rid of it.

Here are the JS files I use:

<script src="/assets/application.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-1.8.0.min.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui-1.8.23.custom.min.js?body=1" type="text/javascript">        </script>
<script src="/assets/autocomplete-rails.js?body=1" type="text/javascript"></script>
<script src="/assets/rails.js?body=1" type="text/javascript"></script>

Rails JS is the rails-ujs script

Xiaoli
  • 73
  • 8
  • 1
    Update your question with code examples and show the problem with a particular link example. That would help to answer your question. – Samiron Sep 30 '12 at 03:56
  • Thanks Samiron, I added some example code... Hopefully I've made my problem clear @Samiron – Xiaoli Sep 30 '12 at 04:35
  • So you mean the webpage is showing `About(/about)` while the html source has nothing to show the `(/about)` part? Its weird then... may be something wrong with your browser settings. Is it same in all browser? – Samiron Sep 30 '12 at 05:57
  • Yes all the browser have this issue and the only pages have this problem are my RoR apps, which I started using rails server... So I thought this is some internal test functionality provided by rails... @Samiron – Xiaoli Sep 30 '12 at 12:54
  • In my bare understanding I can only say that browser will only show something if it gets its corresponding HTML source code... Otherwise may be some javascript is doing that. I'm not sure if there is any CSS to do so. If you create any new application from scratch, does it show the same? – Samiron Sep 30 '12 at 13:44
  • Hmm... Everything is normal in a new app... So it might be a js problem? I've used a few JS in my app, but seems none of them will do so... Added them in the question and might reproduce the app see which file is causing the priblem... – Xiaoli Sep 30 '12 at 14:12
  • I think where the problem came from... It does come from CSS... I am using blueprint library and when remove the whole folder... the urls are gone... Now am checking which file contained in caused this problem. @Samiron – Xiaoli Sep 30 '12 at 14:33

1 Answers1

1

Thanks to @Samiron, finally figured out why. The blueprint css library has a stylesheet defined for printing version, and has the code there:

/*
This has been the source of many questions in the past. This
snippet of CSS appends the URL of each link within the text.
The idea is that users printing your webpage will want to know
the URLs they go to. If you want to remove this functionality,
comment out this snippet and make sure to re-compress your files.
*/
a:link:after, a:visited:after {
  content: " (" attr(href) ")";
font-size: 90%;
}
Xiaoli
  • 73
  • 8
  • :) ah... so css is the culprit. However, im wondering about the keywords of the problem. Anyone have any suggestion? – Samiron Oct 01 '12 at 02:42
  • Though now i just googled with "css to show url after a link" and got the thing in first result :) – Samiron Oct 01 '12 at 02:45