开发者

Rails: Anchor option and link_to

开发者 https://www.devze.com 2023-03-27 19:13 出处:网络
I have 开发者_JAVA技巧a link_to method in Rails link_to(\"feedback\", meetings_url(:anchor => \"sometext\"))

I have 开发者_JAVA技巧a link_to method in Rails

link_to("feedback", meetings_url(:anchor => "sometext"))

=> The above code produces:

<a href="/p/meeting/?scroll_to=sometext">feedback</a>

I thought anchor was supposed to prepend a hash paramter, something like this:

/p/meeting/#sometext


I just tried in the console and I get the expected #anchor

include Rails.application.routes.url_helpers
# => Object
default_url_options[:host] = "localhost"
# => "localhost"
profiles_url(:anchor => "moo")
# => "http://localhost/profiles#moo"

What version of rails are you using? Do yo maybe have a gem or plugin that is overriding your link_to helper? You could create an empty rails app, and try the above test to see if something else is causing it.

0

精彩评论

暂无评论...
验证码 换一张
取 消