Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Rails 6.x where the multipart form enctype was not being applied #30

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

westonganger
Copy link
Owner

Solves #20

In Rails 6.x, form_for ..., multipart: true was not correctly applying the enctype="multipart/form-data" to the HTML form tag

Turns out that in Rails 6.x and prior you are supposed to either use:

  • form_for ..., html: {multipart: true}
  • OR
  • If the form uses the file_field method then the enctype is automatically added

Both of the potential fixes for Rails 6.x, also work in Rails 7.0 and above

@westonganger westonganger force-pushed the fix-multipart-form-for-rails-6 branch from 0954185 to 9860718 Compare February 6, 2025 17:24
@westonganger westonganger merged commit 3816d45 into master Feb 6, 2025
11 checks passed
@westonganger westonganger deleted the fix-multipart-form-for-rails-6 branch February 6, 2025 17:27
@westonganger westonganger mentioned this pull request Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant