aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/rails_generator/commands.rb4
2 files changed, 4 insertions, 2 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index fd797dda86..88d9371833 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Generator copies files in binary mode. #3156 [minimudboy@gmail.com]
+
* Add builtin/ to the gemspec. Closes #3047. [Nicholas Seckar, Sam Stephenson]
* Add install.rb file to plugin generation which is loaded, if it exists, when you install a plugin. [Marcel Molina Jr.]
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb
index 32a7b602d7..bd5754b72d 100644
--- a/railties/lib/rails_generator/commands.rb
+++ b/railties/lib/rails_generator/commands.rb
@@ -215,8 +215,8 @@ module Rails
# if block given so templaters may render the source file. If a
# shebang is requested, replace the existing shebang or insert a
# new one.
- File.open(destination, 'w') do |df|
- File.open(source) do |sf|
+ File.open(destination, 'wb') do |df|
+ File.open(source, 'rb') do |sf|
if block_given?
df.write(yield(sf))
else