Hotwire Summer: The most underrated Rails helper is dom_id
One of the oldest helpers in Rails is also the most underrated. `dom_id` shines for building apps with Hotwire, allowing you to target parts of the page without a bunch of nasty string interpolation.
The `dom_id
` helper in Rails is over a decade old (I did `git blame
` to prove it…), but has proven to be an invaluable concept in Hotwire. This secret workhorse powers all kinds of HTML-related behavior in Rails.
In this article I share use-cases where I’ve used `dom_id
` lately: generating HTML with tag builders, deep linking with anchors, and targeting Turbo Frames and Streams. Plus a bunch of other secret tips thrown in for good measure!
👉 Read it here: The most underrated Rails helper: dom_id
📣 Have feedback? Join the discussion on Twitter
Stay boring!
- Matt