vue-rails-form-builder icon indicating copy to clipboard operation
vue-rails-form-builder copied to clipboard

Option to camelize object name and attributes

Open tiagocassio opened this issue 7 years ago • 4 comments

Hi, first of all, i want to say thank you for this great project!

I would like to camelize object name and attribute names to standard Javascript attribute sintax.

Ex.:

Instead this: v-model="my_model.my_attribute"

I want to render this: v-model="myModel.myAttribute"

What method in this gem does the insertion of "v-model" tag inside the form?

Thanks for all.

tiagocassio avatar Jun 01 '18 14:06 tiagocassio

Thank you for being interested in my gem.

I have to think carefully about your proposal, because it breaks existing projects that adopt this gem.

For your question, see:

https://github.com/kuroda/vue-rails-form-builder/blob/03cb4abb92eeb9352bbdb02d33b83e85c53a1c72/lib/vue-rails-form-builder/vue_options_resolver.rb#L42-L49

kuroda avatar Jun 01 '18 14:06 kuroda

I've added a option to camelize object and attribute names into vue_form_with and vue_form_for method with default: false to allow this. If you want to see, i can make a pull request.

tiagocassio avatar Jun 01 '18 15:06 tiagocassio

Yes, I want to see it.

kuroda avatar Jun 02 '18 00:06 kuroda

Done. Checkout #5 PR!

tiagocassio avatar Jun 04 '18 11:06 tiagocassio