Part of organizing your Rails views is having reliable partials. You should hav a standard set of templates, which helps you know what is what.
My main views are still going to match the actions, index
, new
, and edit
. These will typically have an HTML version, and now-a-days, often a TurboStream version. create
, update
, and delete
typically only have a version for TurboStream.
_form
will provide a fully featured editing experience. It’s not uncommon to also have an _inline_form
with a subset of fields.
The main partial for a class will be named after the class, so Product matches _product
. This is used for the main view of a class and should be embedable anywhere. It is also common to need a list view version of a class. I typically use a _row
partial for this.
By using and thinking of partials, you can build a robust system for representing your data consistently throughout your system.