Permalink
Browse files

Merge pull request #8303 from jeremywrowe/master

Fixes improper database name when creating a new rails app with a '.'

Conflicts:
	railties/CHANGELOG.md
  • Loading branch information...
2 parents 48d05bd + c45980f commit 9826823e665e612f0a166da6b2f8e5007183400b @rafaelfranca rafaelfranca committed Jan 25, 2013
@@ -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
@@ -236,7 +236,7 @@ def file(*args, &block)
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
@@ -164,6 +164,11 @@ def test_config_another_database
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/

0 comments on commit 9826823

Please sign in to comment.