URL helpers with fragment
30 Jun 2023When using a URL helper you can specify a fragment with the anchor
option:
post_path(post.root, anchor: "post_#{post.id}")
# => "/posts/42#post_69
Previously, I was manually doing something similar like:
"#{post_path(post.root)}#post_#{post.id}"
# => "/posts/42#post_69