pantographe / view_component-form

Rails FormBuilder for ViewComponent
MIT License
204 stars 16 forks source link

Fix file field direct upload option #122

Closed rowofpixels closed 2 years ago

rowofpixels commented 2 years ago

The file_field helper converts the direct_upload option to a data attribute: https://github.com/rails/rails/blob/main/actionview/lib/action_view/helpers/form_helper.rb#L1242

This change would make this example from the rails guide (found here) work:

<%= form.file_field :attachments, multiple: true, direct_upload: true %>

There may be a better alternative to before_render, I wasn't sure the best place to put it. #initialize won't work since we need helpers to be accessible.

nicolas-brousse commented 2 years ago

@rowofpixels may you add an entry in changelog file please?

nicolas-brousse commented 2 years ago

Thanks @rowofpixels

@Spone if it's good for you I let you merge this. I'll make a patch release when merged

nicolas-brousse commented 2 years ago

@rowofpixels I just released https://github.com/pantographe/view_component-form/releases/tag/v0.2.4