简体   繁体   English

Rails中link_to面临的问题

[英]Facing issue with link_to in Rails

I am using link_to in the following manner in view: 我以以下方式使用link_to:

<td><%=link_to("https://www.google.com/")%></td>

But on hovering/clicking on the link still redirects me to http://localhost:3000/ . 但是在悬停/单击链接时,仍会将我重定向到http://localhost:3000/ How do I redirect it to Google. 如何将其重定向到Google。

<td><%=link_to("https://www.google.com/", "https://www.google.com/")%></td>

此处有更多详细信息: link_to doc

after link_to you have to describe the name what you want to show as link then pass your link. link_to之后,您必须描述您想要显示为链接的名称,然后传递您的链接。 like this: 像这样:

   <td> <%= link_to "Google", "http://www.google.com" %> </td>

For more info: Reference 有关更多信息: 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM