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

Added option to camelize object and attributes.

Open tiagocassio opened this issue 7 years ago • 7 comments

tiagocassio avatar Jun 04 '18 11:06 tiagocassio

@tiagocassio

Thanks. Could you add some description to the README.md?

kuroda avatar Jun 04 '18 12:06 kuroda

Done! Thanks!

tiagocassio avatar Jun 04 '18 12:06 tiagocassio

I checked your code on my local PC.

I noticed that when I use fields_for, the attribute names do not get camelized.

Unfortunately, I can not find any solution for this problem.

kuroda avatar Jun 04 '18 14:06 kuroda

Now I think it is rather inconvenient for developers to specify camelize option for each form_for and form_with. It should be configured globally.

But I don't any idea how to allow this configuration on this gem.

kuroda avatar Jun 04 '18 14:06 kuroda

I confess that i was not expecting this. I will try at night, i'm out now.

tiagocassio avatar Jun 04 '18 14:06 tiagocassio

This type of option should also be in the initializer, like jBuilder. This would also maintain backward compatibility for people need to upgrade, in the same manner, that Rails does; If the default was to change.

If your interested, I took this PR and upgraded my fork. https://github.com/sirwolfgang/vue-rails-form-builder

Edited: I forgot how you have to change a ton of tiny settings to get everything in default rails to be camel case.

sirwolfgang avatar Jul 27 '18 04:07 sirwolfgang

The issue you are seeing with setting the options here is that camelize is being set on the form and not the tags. You have to store the form options on the builder, then use it for each tag like this: https://github.com/sirwolfgang/vue-rails-form-builder/commit/574fd66e8f7a589d47109687fdb981656b9323a4

sirwolfgang avatar Jul 27 '18 06:07 sirwolfgang