Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set const for application object. "Basecamp::Application"

  • Loading branch information...
commit 85e0a6cd7df2081c5578fe4b563f26d1cc791b6b 1 parent 968c994
@josh josh authored
View
4 railties/lib/rails/generators/rails/app/templates/config/environment.rb
@@ -6,7 +6,9 @@
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
-Rails::Initializer.run do |config|
+module <%= app_name.camelize %>; end
+
+<%= app_name.camelize %>::Application = Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

4 comments on commit 85e0a6c

@apacala

I don't feel like the application module belongs here. Shouldn't it go to the app_name.rb in lib/ ?

@alloy

A problem here, is that camelize is ignorant about which characters are allowed in a mod's name. And rightfully so. But this does mean, that generating an application called, for instance, "test-case", will create a module like this: "module Test-case; end".

@josh
Collaborator

@alloy Good call. You can create a patch if you want.

But this is kind of temporary/experimental direction. We want to be more friendly about namespacing your application so multiple rails apps can exist in the same space.

@alloy

I skipped this because, as Josh said, it was experimental anyways and it's already removed again from the current HEAD afaik.

I figured that actually classify would have been the best place to fix this, something like .gsub(/[^\W]+/, '_'), so it would get camelized correctly conform to a Ruby class name. But now that the real need is gone, I won't bother adding probably unused code.

Please sign in to comment.
Something went wrong with that request. Please try again.