How to create an anchor and redirect to this specific anchor in Ruby on Rails

后端 未结 6 1112
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-05 17:04

I\'m trying to create unique anchors for every comment on my blog so a person can take the url of an anchor and paste it in their browser, which will automatically load the

6条回答
  •  一生所求
    2020-12-05 17:54

    this is best way:

    <%= link_to '#', post_path(comment.post, anchor: dom_id(comment.id)) %>
    

提交回复
热议问题