link_to underlying urls/paths are showing in the actual view

for example I have the following simple code in my views:

<%= link_to "Here", :controller => 'home', :action => 'inside_here' %>

I get the "actual" view in the page looking like this:

Here (/home/inside_here)

where the underlying url is showing right beside the "Here" word. By default, the "Here" word should only be outputted and not the path underneath it.

Since we presently have no solution to this, my front-end guy keeps on enclosing these links with <divs> so as to hide the underlying links. It's a big headache for him.. he's stressed.

Does anybody have any suggestion on what's happening? Maybe there's something wrong with the layout or with the stylesheets? Or javascript? Since the front-end guy was previously developing using Php and HTML that there might be some tiny detail that shouldn't be used in Rails by convention. Although he knows the basics needed to output stuff (like link_to, image_tag, etc) in Rails... Thanks a lot!

for example I have the following simple code in my views:

<%= link_to "Here", :controller => 'home', :action => 'inside_here' %>

I get the "actual" view in the page looking like this:

Here (/home/inside_here)

where the underlying url is showing right beside the "Here" word. By default, the "Here" word should only be outputted and not the path underneath it.

Since we presently have no solution to this, my front-end guy keeps on enclosing these links with <divs> so as to hide the underlying links. It's a big headache for him.. he's stressed.

Does anybody have any suggestion on what's happening? Maybe there's something wrong with the layout or with the stylesheets? Or javascript? Since the front-end guy was previously developing using Php and HTML that there might be some tiny detail that shouldn't be used in Rails by convention. Although he knows the basics needed to output stuff (like link_to, image_tag, etc) in Rails... Thanks a lot!

My guess is you have some javascript that is doing this. Rails doesn't do this by default.

Or, perhaps you have installed a plugin that overrides how link_to works.

-philip

Adler Santos wrote:

for example I have the following simple code in my views:

<%= link_to "Here", :controller => 'home', :action => 'inside_here' %>

I get the "actual" view in the page looking like this:

Here (/home/inside_here)

where the underlying url is showing right beside the "Here" word. By default, the "Here" word should only be outputted and not the path underneath it.

I'm getting the same thing. I'm on Rails 3.0.0.beta4.

Have you found a solution to this?

I'm getting the same thing. I'm on Rails 3.0.0.beta4.

Have you found a solution to this?

One more thing. I only get this when I use Firefox (I haven't tried Opera or Chrome though). In Interet Explorer, this works how it should with only showing the names and not the the paths in parenthesis.

I also took out the JavaScript in the app. I still recieve this in Firefox after removing JavaScript.

Has anyone found a solution to this or is anyone else having this issue?

It's odd to me that Adler and I would be the only ones. Especially since I am only using the defaults that Rails 3.0.0.beta4 provides.

I didn't change the default JavaScript files. I have added them using :defaults. I don't have any custom JavaScript running. I don't have any added gems or plugins in my app yet.

Also, like I stated previously, this only happens when I use FireFox. Which is another oddity. Internet Explorer displays this correctly.

Any help on this issue would be greatly appreciated.

Thanks in advance,

--Matt Royer

I believe it is a FF add-on that does this, I have seen the question asked before, though don't remember which one. Disable all your FF add-ons (Tools, Addons and disable them all) and see if it goes away.

Colin

Could you try wrapping the controller, action, etc. in a url hash

<%= link_to “Here”, :url => {:controller => ‘home’, :action => ‘inside_here’ }%>

The path is showing up in my links too. Tried Safari and FireFox. Did you find a solution to this problem?

/landge

Matt Royer wrote:

Everything is fine with the IE 7!? What does this mean?

/landge

Jule Nissen wrote:

Everything is fine with the IE 7!? What does this mean?

If you look at the html of the page (View, Page Source or similar in your browser) what do you see for the link tag? Post the link tag here if necessary.

Do you only see this on your rails app or is it on all pages?

Colin

Colin Law wrote: This is what I get (IE7):

<a href="#" id="toggle" onclick="Effect.toggle('vakt'); return false;">Ukekalendar</a>     <div class="span-24" style="display:none" id="vakt" >

        <a href="/nevrovakt/aktuelluke/1">1</a>

        <a href="/nevrovakt/aktuelluke/2">2</a>

        <a href="/nevrovakt/aktuelluke/3">3</a>

        <a href="/nevrovakt/aktuelluke/4">4</a>

etc. ....

You can try it if you want on my testpage: http://vaktliste.nevroradiologi.no The path is only visible on my rails page

thanks,

landge

Colin Law wrote:

Could you make sure you get your quoting correct please and insert your comments in the right place, I did not write the text below, you did. Thanks.

This is what I get (IE7):

<a href="#" id="toggle" onclick="Effect.toggle('vakt'); return false;">Ukekalendar</a> <div class="span-24" style="display:none" id="vakt" >

   &lt;a href=&quot;/nevrovakt/aktuelluke/1&quot;&gt;1&lt;/a&gt;

   &lt;a href=&quot;/nevrovakt/aktuelluke/2&quot;&gt;2&lt;/a&gt;

   &lt;a href=&quot;/nevrovakt/aktuelluke/3&quot;&gt;3&lt;/a&gt;

   &lt;a href=&quot;/nevrovakt/aktuelluke/4&quot;&gt;4&lt;/a&gt;

etc. ....

You can try it if you want on my testpage: http://vaktliste.nevroradiologi.no The path is only visible on my rails page

The w3c html validator is not impressed with your html, see Validation Results - W3C Markup Validator. Whether this is the problem or not I do not know, but I would fix it first.

If still not fixed then, since the additional text is not visible in the html then I think either javascript or css must be doing it. I would remove all the includes for scripts and css and see what happens. Leave the code as it is, just remove the includes. But fix the html first.

Colin

Colin Law wrote:

Colin Law wrote:

Could you make sure you get your quoting correct please and insert your comments in the right place, I did not write the text below, you did. Thanks.

Ok

The w3c html validator is not impressed with your html, see Validation Results - W3C Markup Validator. Whether this is the problem or not I do not know, but I would fix it first.

If still not fixed then, since the additional text is not visible in the html then I think either javascript or css must be doing it. I would remove all the includes for scripts and css and see what happens. Leave the code as it is, just remove the includes. But fix the html first.

Thanks for your advice. I'll try it later.

Thanks for the tip Colin!

The visible path behind the links was generated by the css print layout. Everything works fine now!

Well, I still have to fix the html errors :wink:

/landge

Jule Nissen wrote:

The visible path behind the links was generated by the css print layout. Everything works fine now!

YES!!! Thanks everyone. This was driving me insane! I'm using the Blueprint CSS Framework. In the Print.css there is a line that reads:

What I do not understand about this is why this was (apparently) showing on screen when it was in print.css, which presumably is only intended to be used for printing.

Colin

Colin Law wrote:

What I do not understand about this is why this was (apparently) showing on screen when it was in print.css, which presumably is only intended to be used for printing.

That was odd to me too. I guess I was just excited that my issue was solved, because I didn't even think to check more into that. Think it's something in Rails itself? Or the browsers. Maybe the way you use: stylesheet_link_tag :all

I'm not sure. Just grasping at straws. That's how I import my css sheets.

That will load all the stylesheets in the stylesheets folder. If you have print and screen specific stylesheets you should load these individually specifying :media => "screen" and :media => "print" for the two relevant files so that one will be used on screen and the other for printing.

Colin