简体   繁体   English

link_to辅助网址异常

[英]link_to helper weird url

Hello everyone I was wondering how I can get rid of this ugly url that was generated when I clicked a link on my website. 大家好,我想知道如何摆脱当我单击网站上的链接时生成的丑陋网址。 It looks like this: 看起来像这样:

http://www.imaaroncs.com/about?as=AboutMe&class=changeMe&controler=welcome

I want it to just say about but I do not know how to do it with the link_to rails helper this is what I have so far: 我只想说一下,但是我不知道如何使用link_to rails helper做到这一点,到目前为止,我的工作是:

<li class="navbar-brand"><%= link_to "About Me", class: "changeMe",controler: "welcome", as: "AboutMe", action: "about"%>

您正在发送一些不需要的参数(?之后的那些被解释为其他查询参数)

<%= link_to "About Me", action: "about" %>

Try using the literal hash: 尝试使用文字哈希:

<%= link_to "About Me", {class: "changeMe", controller: "welcome", as: "AboutMe", action: "about"} %>

PS. PS。 Also, there is double l in controller. 另外,控制器中有双l You have one. 你有一个。

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

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