diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-01-25 10:21:48 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-01-25 10:21:48 -0200 |
commit | 9826823e665e612f0a166da6b2f8e5007183400b (patch) | |
tree | fa16159ce91ea733f36c85af6b2f6fd5db54ec49 | |
parent | 48d05bdd97e067b534b158bdf56256b45bf59e48 (diff) | |
parent | c45980fe6e8200837b70482a177bbca87b654fdf (diff) | |
download | rails-9826823e665e612f0a166da6b2f8e5007183400b.tar.gz rails-9826823e665e612f0a166da6b2f8e5007183400b.tar.bz2 rails-9826823e665e612f0a166da6b2f8e5007183400b.zip |
Merge pull request #8303 from jeremywrowe/master
Fixes improper database name when creating a new rails app with a '.'
Conflicts:
railties/CHANGELOG.md
-rw-r--r-- | railties/CHANGELOG.md | 5 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 5 |
3 files changed, 11 insertions, 1 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index ab30962aad..c6ffe30ad3 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,5 +1,10 @@ ## Rails 4.0.0 (unreleased) ## +* Fixes database.yml when creating a new rails application with '.' + Fix #8304 + + *Jeremy W. Rowe* + * Deprecate the `eager_load_paths` configuration and alias it to `autoload_paths`. Since the default in Rails 4.0 is to run in 'threadsafe' mode we need to eager load all of the paths in `autoload_paths`. This may have unintended consequences diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index e22be40381..b2d1be9b51 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -236,7 +236,7 @@ module Rails end def app_name - @app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root) + @app_name ||= (defined_app_const_base? ? defined_app_name : File.basename(destination_root)).tr(".", "_") end def defined_app_name diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index ee93dc49cd..b2deeb011d 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -164,6 +164,11 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_config_database_app_name_with_period + run_generator [File.join(destination_root, "common.usage.com"), "-d", "postgresql"] + assert_file "common.usage.com/config/database.yml", /common_usage_com/ + end + def test_config_postgresql_database run_generator([destination_root, "-d", "postgresql"]) assert_file "config/database.yml", /postgresql/ |