Owen Roth

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Hey everyone,

I am attempting to build a checkbox filter with Rails 7.

I would like to render a list of businesses on a page and have a side panel with a bunch of checkboxes. This side panel would have a checkbox for every city option. When a user clicks the checkbox for "New York", the list of businesses broadcasts the filter query and displays all businesses in New York without refreshing the page / clicking submit.

Are there any resources for how to develop the above? I thought about using a combination of Ransack, Turbo frames, and Stimulus. Essentially what I was thinking was that I would have some "onChange" listeners on the checkboxes then render the filter with some combination of Ransack / Turbo frames. Seems kind of complex. Am I over thinking this?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.