Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use binary mode to write uploaded files [ci skip] See: http://stackov…

…erflow.com/a/4988984/129798 for an explanation for why this is required for Ruby 1.9.
  • Loading branch information...
commit 92a03d888e0053962061fdfb1139c91e086bff0e 1 parent 5c6e11d
Brendon Muir brendon authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  guides/source/form_helpers.md
2  guides/source/form_helpers.md
View
@@ -605,7 +605,7 @@ The object in the `params` hash is an instance of a subclass of IO. Depending on
```ruby
def upload
uploaded_io = params[:person][:picture]
- File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'w') do |file|
+ File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|
file.write(uploaded_io.read)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.