Hotwire, Rails and Convention over Configuration

Hi all, My team has been using Rails 7 + Hotwire since October, having ported a large app over to it entirely. Several of us are ex-Rails folks from the Rails 2 / 3 days.

I love Rails and Ruby. Love them. But my team has struggled with Hotwire because it violates a core principle of Rails - Convention over Configuration. Every Hotwire guide tends to say “here are 8 ways to accomplish goal X”. It is good for the “sharp knives” principle, but not the Convention one. The result is that I find a lot of features in our codebase that are similar in function but implemented very differently.

We have been building more DSLs and libraries for adding our own standards internally, and I would love to put in the extra effort to try to integrate these to Rails themselves if they were consistent with expected usage. But that latter question shows the very point I am worried about - it is not even clear to me if the things we are standardizing on are what would be considered expected usage.

The 2 items that feel like the core of standardization here for extremely common tasks are:

  1. Extending the form helper with a “refresh_after_edit” parameter so that after a field with that argument is edited, it refreshes the form from the server. This is done via a PUT to the /new or /edit forms (and those actions are exposed for PUT as well as GET). Dynamic forms are a very common scenario, and this needs native support
  2. Implementing Tabs. This is the most-common place where I see radically disparate implementations, but it is adjacent to several other common tasks in the UI. We are solving it with [excid3/tailwindcss-stimulus-components: A set of StimulusJS components for TailwindCSS apps similar to Bootstrap JS components. Tailwind Stimulus Components and I know that Rails has not wanted to ‘back’ a CSS scheme, but I think once needs to be used as a reference implementation. i.e. Default-install a gem like that with Tailwind, with a message that other CSS systems are encouraged to put in gems that are generally API-consistent with those stimulus components and just different for the CSS handling.

I want to say again - this all comes from a place of love, and a place of willingness to do some work to make it happen. But I wanted to understand appetite for this if that work happens.

Thanks for everyone’s efforts on Rails!


Hi Noah,

Could my gem render_turbo_stream be of interest to you?

Perhaps the method turbo_stream_save might not do exactly what you mean for point 1. but help in this direction?

Best Regards, Chris

1 Like