aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2012-12-18 16:26:08 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2012-12-18 16:26:08 +0100
commitf6bbc3f582bfc16da3acc152c702b04102fcab81 (patch)
tree11220181fb304be16c3efe8580a1be6118ff4bf4 /railties
parentdcb318ee438785239fad27ece96c3cf6dd7ce12e (diff)
downloadrails-f6bbc3f582bfc16da3acc152c702b04102fcab81.tar.gz
rails-f6bbc3f582bfc16da3acc152c702b04102fcab81.tar.bz2
rails-f6bbc3f582bfc16da3acc152c702b04102fcab81.zip
Add app/models/concerns and app/controllers/concerns to the default directory structure and load path
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md4
-rw-r--r--railties/lib/rails/engine/configuration.rb9
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb4
3 files changed, 17 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index ed5dfc6446..239fc10719 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,5 +1,9 @@
## Rails 4.0.0 (unreleased) ##
+* Add app/models/concerns and app/controllers/concerns to the default directory structure and load path *DHH*
+
+ See http://37signals.com/svn/posts/3372-put-chubby-models-on-a-diet-with-concerns for usage instructions.
+
* The `public/index.html` is no longer generated for new projects.
Page is replaced by internal `welcome_controller` inside of railties.
diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb
index 22e885a3a6..10d1821709 100644
--- a/railties/lib/rails/engine/configuration.rb
+++ b/railties/lib/rails/engine/configuration.rb
@@ -38,6 +38,7 @@ module Rails
def paths
@paths ||= begin
paths = Rails::Paths::Root.new(@root)
+
paths.add "app", eager_load: true, glob: "*"
paths.add "app/assets", glob: "*"
paths.add "app/controllers", eager_load: true
@@ -45,19 +46,27 @@ module Rails
paths.add "app/models", eager_load: true
paths.add "app/mailers", eager_load: true
paths.add "app/views"
+
+ paths.add "app/controllers/concerns", eager_load: true
+ paths.add "app/models/concerns", eager_load: true
+
paths.add "lib", load_path: true
paths.add "lib/assets", glob: "*"
paths.add "lib/tasks", glob: "**/*.rake"
+
paths.add "config"
paths.add "config/environments", glob: "#{Rails.env}.rb"
paths.add "config/initializers", glob: "**/*.rb"
paths.add "config/locales", glob: "*.{rb,yml}"
paths.add "config/routes.rb"
+
paths.add "db"
paths.add "db/migrate"
paths.add "db/seeds.rb"
+
paths.add "vendor", load_path: true
paths.add "vendor/assets", glob: "*"
+
paths
end
end
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index c98f021cfe..372790df59 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -55,8 +55,12 @@ module Rails
def app
directory 'app'
+
keep_file 'app/mailers'
keep_file 'app/models'
+
+ keep_file 'app/controllers/concerns'
+ keep_file 'app/models/concerns'
end
def config