开发者

Rails: Anchor option and link_to

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜