Replies: 5 comments 1 reply
-
True, having a Rails Guide dedicated to dynamic forms would undoubtedly benefit the community by providing a clear path and best practices for tackling this common use case, and it's evident that there's a demand for it. |
Beta Was this translation helpful? Give feedback.
-
I don't know if 37Signals has many of these forms and has a pattern already. My company (Unsupervised.com) created one that has generally worked well, but I suspect DHH and others would suggest changes. I am happy to record and link a video of our approach if it is helpful for this. |
Beta Was this translation helpful? Give feedback.
-
@AmandaPerino - I realized I should tag you on this one as it is probably pretty related to Foundation work. The #1 thing that I think is a legitimate "React TS backends is better than Rails" right now is dynamic forms, and that is not because it is technically true, but because there is zero guidance on how to do it in Rails using Hotwire. Those types of forms are insanely common, and every user is starting from zero on it right now. |
Beta Was this translation helpful? Give feedback.
-
Hi @nhorton thanks for tagging me. This is a question/comment that I hear pretty often, or rather - I hear questions about including Hotwire more in the Rails documentation, especially now that it is becoming the default more and more. I'll reach out to 37signals and Rails Core to hear their ideas around where we should cover this. |
Beta Was this translation helpful? Give feedback.
-
Hey @AmandaPerino - have you heard anything more on this? I am at an offsite with developers right now and just listened to a 15 minute conversation about how many issue people had hit with this topic. |
Beta Was this translation helpful? Give feedback.
-
This is for the doc effort.
One of the things I see questions on the most in things like Reddit forums and conversations with engineers who have been doing React a lot is how to do dynamic forms in Rails. In this context, I mean dynamic to mean things like having the choice of one field alter the other fields available or their options.
My company went through 3 iterations to get to a pattern we really like on this wherein we have a
refresh_form
action that re-renders our form partial for both New and Edit forms, with a stimulus controller that we attach to any field we want to trigger such a dynamic changing of the form. However, herein lies the real point: we had to set a standard for this ourselves, and there is no Rails Way for it that is documented.This is a massively common use case, and having a Rails Guide for it that started to establish a Rails Way would be great. I suspect we would see some more pre-canned functionality to simplify this use case, but just the docs would be massively productive.
Beta Was this translation helpful? Give feedback.
All reactions