link_to Base URL Randomly Changed

这一生的挚爱 提交于 2019-12-13 04:56:53

问题


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'

回答1:


Set paths in link_to tag which you can get from rake_routes

Ex.

link_to "Profile", profile_path(@profile)


来源:https://stackoverflow.com/questions/25391021/link-to-base-url-randomly-changed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!