link_to基本URL随机更改 [英] link_to Base URL Randomly Changed
问题描述
我正在使用 link_to
创建自定义链接。由于某种原因,我的网址始终是错误的,并在网址中随机添加了 blog
。我不知道为什么。只能在我要渲染的部分内容中执行此操作(在页面上3次)。
我可以共享任何必要的代码,但是会在哪里随机获取
浏览器呈现:
< a href = / blog?controller = quote>选择费率< / a>
我的视图(使用 slim
)是:
-对于loantek_rates中的利率
-loantek_closing_costs = LoantekClosingCosts.new(rate)
= link_to'选择费率',{controller:'quote'}
路线
#routes.rb
match / blog => redirect( http://blog.mywebsite.com),路径:'/ blog'
资源:引用,路径:'quote'
在 link_to
标记中设置路径,您可以从 rake_routes
Ex。
链接到个人资料,profile_path(@profile)
I'm using link_to
to create a custom link. For some reason, my url always is wrong and randomly adds blog
to the URL. I can't figure out why. It only does this while within the partial that I am rendering (3 times on the page).
I can share any code necessary, but where the hell would it randomly grab the blog URL?
The browser renders:
<a href="/blog?controller=quote">Select Rate</a>
My view (using slim
) is:
- for rate in loantek_rates
- loantek_closing_costs = LoantekClosingCosts.new(rate)
= link_to 'Select Rate', {controller: 'quote'}
Routes
#routes.rb
match "/blog" => redirect("http://blog.mywebsite.com"), path: '/blog'
resources :quotes, path: 'quote'
Set paths in link_to
tag which you can get from rake_routes
Ex.
link_to "Profile", profile_path(@profile)
这篇关于link_to基本URL随机更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!