Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes improper database name when a '.' is included while creating a …

…new rails

application. EG: `rails new something.awesome.com`
Conflicts:
	railties/CHANGELOG.md
  • Loading branch information...
commit c45980fe6e8200837b70482a177bbca87b654fdf 1 parent 555cb0a
@jeremywrowe jeremywrowe authored
View
5 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*
+
* Allow a `:dirs` key in the `SourceAnnotationExtractor.enumerate` options
to explicitly set the directories to be traversed so it's easier to define
custom rake tasks.
View
2  railties/lib/rails/generators/rails/app/app_generator.rb
@@ -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
View
5 railties/test/generators/app_generator_test.rb
@@ -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/
Please sign in to comment.
Something went wrong with that request. Please try again.