Question

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

Was it helpful?

Solution

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%;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top