Ruby on Rails link_to内部id
如果我想转到我可以使用的页面上的“whatever_id”,我如何使用link_to来正常转到页面上的特定(html)ID
Click Here
但我想用我的link_to
"mypage", :controller => "index" }, :id => "#whatever_id"%>
辅助方法。 有谁知道如何做到这一点? 可能吗?
Rails 2.3.4
link_to可以将锚点添加到URL。
从文档中 ,
link_to "Comment wall", profile_path(@profile, :anchor => "wall") # => Comment wall
在你的情况下,你可能想要,
<%= link_to "click here" , {:action => "index", :controller => "mypage", :anchor => "whatever" } %>