diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-16 20:34:06 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-16 20:34:06 -0300 |
commit | 8941d5a36fb06211eb4672fec1169372602232ea (patch) | |
tree | e2fc7c826a90ee0b1dc7ee3679a736bb033c680b /railties | |
parent | 779ff5cdeb8aa1cffb112e0d40baa57b33a29844 (diff) | |
download | rails-8941d5a36fb06211eb4672fec1169372602232ea.tar.gz rails-8941d5a36fb06211eb4672fec1169372602232ea.tar.bz2 rails-8941d5a36fb06211eb4672fec1169372602232ea.zip |
Generate the cookies_serializer configuration with :marshal when upgrading
We were generating this configuration with :json what may break
applications upgrating from Rails 4.0-.
Now we always generate with a safer value and people is free to choose
hybrid if they want.
We don't generate with hybrid by default because there are some cases
that can fail. These cases are explained on the upgrading guide.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 11 | ||||
-rw-r--r-- | railties/lib/rails/tasks/framework.rake | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 8675d8bc1e..e3a4a70e93 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -86,6 +86,13 @@ module Rails end end + def config_when_updating + foo = File.exist?('config/initializers/cookies_serializer.rb') + config + + gsub_file 'config/initializers/cookies_serializer.rb', /json/, 'marshal' unless foo + end + def database_yml template "config/databases/#{options[:database]}.yml", "config/database.yml" end @@ -188,6 +195,10 @@ module Rails build(:config) end + def update_config_files + build(:config_when_updating) + end + def create_boot_file template "config/boot.rb" end diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index 3c8f8c6b87..a1c805f8aa 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -55,7 +55,7 @@ namespace :rails do # desc "Update config/boot.rb from your current rails install" task :configs do invoke_from_app_generator :create_boot_file - invoke_from_app_generator :create_config_files + invoke_from_app_generator :update_config_files end # desc "Adds new executables to the application bin/ directory" |