如何使用链接?以便正常转到页面上的特定(HTML)ID 如果我想转到我可以使用的页面上的“随便什么ID”
<a href="http://www.example.com/index/mypage#whatever_id>Click Here</a>
但是我想用我的链接
<%= link_to "click here" , {:action => "mypage", :controller => "index" }, :id => "#whatever_id"%>
帮助程序方法。有人知道怎么做吗?有可能吗?
Rails 2.3.4
林克托 可以向URL添加锚。
来自 documentation ,
link_to "Comment wall", profile_path(@profile, :anchor => "wall") # => <a href="/profiles/1#wall">Comment wall</a>
如果你想的话,
<%= link_to "click here" , {:action => "index", :controller => "mypage", :anchor => "whatever" } %>