JangoSteve / remotipart

Rails jQuery file uploads via standard Rails "remote: true" forms.
http://os.alfajango.com/remotipart
Other
1k stars 215 forks source link

Fix ActionDispatch::IllegalStateError (header already sent). Change Mime::HTML for Mime[:html] #140

Closed urielhdz closed 6 years ago

urielhdz commented 8 years ago

Fixe the ActionDispatch::IllegalStateError (header already sent) error produced by changing the response type on line 18 of the render_with_remotipart method, which also was using a deprecated way to access mime types.

The error didn't prevented the library from uploading the file, but did produced an error at the response moment which prevented the response for being properly executed

Note: I have manually tested the changes but I don't have enough knowledge on AJAX testing to create automatic tests, also it's possible that my solution is not "the rails way" as this is my first public contribution.

urielhdz commented 8 years ago

This is meant to fix errors in Rails 5

jordanandree commented 8 years ago

This fixes and works with Rails 5 for me! Thanks @urielhdz

n-rodriguez commented 8 years ago

Hi there! Any news?

mshibuya commented 8 years ago

This change breaks current behavior, because textarea wrapper's data-type will be always be Mime[:html]. https://github.com/JangoSteve/remotipart/blob/master/lib/remotipart/render_overrides.rb#L19

mshibuya commented 6 years ago

88d9a7d55bde66acb6cf3a3c6036a5a1fc991d5e have solved this, I believe.