Hey Roman ! Thanks ! Our take on the issue is quite different from cocoon. We're providing users with a complete wrapper around nested_attributes, which includes :
Easy configuration and syntax in the model
Easier permission of attributes in the controller
Either a preconfigured one-liner, or a very flexible way of displaying fields on the view side (without having to resort to quirky and unreliable data attributes)
Generators, including one that generates all the above config + a pre-filled partial.
Also, cocoon is implemented in jquery, whereas we chose to implement everything with stimulus. Have a look at the doc for more details 😬
it's cool that you've written a simple version of cocoon and are capable of customizing few aspects of it, like say replacing jquery with stimulus, etc.
Has it come due to a difficulty of sending PRs into an existing code base?
In all honesty, we didn't feel like doing so. Neither of us ever liked working with cocoon but still did because it was the only available tool to help with the issue at hand. I think contributing to an existing codebase makes sense for projects you love and wish to support and enhance, but here we really wanted to start from scratch with a completely different approach.
That being said, it's one of our main references for this project, and it helped us tremendously in writing some parts of the gem. Like I said, learn from the best ; (the missing part was "Then, try and make it better !" 🤓)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article, but how do you differentiate your gem from the already pretty famous "Cocoon"?
Hey Roman ! Thanks ! Our take on the issue is quite different from cocoon. We're providing users with a complete wrapper around
nested_attributes
, which includes :cocoon
is implemented injquery
, whereas we chose to implement everything withstimulus
. Have a look at the doc for more details 😬Alright cool! I definitely try it out next time in need for nested forms! ✌️
Cool to use stimulus, it's definitely an underrated framework!
In all honesty, we didn't feel like doing so. Neither of us ever liked working with
cocoon
but still did because it was the only available tool to help with the issue at hand. I think contributing to an existing codebase makes sense for projects you love and wish to support and enhance, but here we really wanted to start from scratch with a completely different approach.That being said, it's one of our main references for this project, and it helped us tremendously in writing some parts of the gem. Like I said, learn from the best ; (the missing part was "Then, try and make it better !" 🤓)