aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-17 00:25:32 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-17 00:25:32 +0000
commitf918d40ee610cedb87f54ebdcaa9233889a145f8 (patch)
tree08c1ec9960a3d22439c760acac5e9714adf18559
parentdf1c6995f7cf08bfae29b1173eb8ca1b2645588c (diff)
downloadrails-f918d40ee610cedb87f54ebdcaa9233889a145f8.tar.gz
rails-f918d40ee610cedb87f54ebdcaa9233889a145f8.tar.bz2
rails-f918d40ee610cedb87f54ebdcaa9233889a145f8.zip
Fixed a bug that would cause an ApplicationController to require itself three times and hence cause filters to be run three times [evl]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@201 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG5
-rwxr-xr-xactionpack/Rakefile2
-rw-r--r--actionpack/lib/action_controller/dependencies.rb9
3 files changed, 11 insertions, 5 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 3043e95352..2a9bc9027a 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,3 +1,8 @@
+*1.0.1*
+
+* Fixed a bug that would cause an ApplicationController to require itself three times and hence cause filters to be run three times [evl]
+
+
*1.0*
* Added that controllers will now attempt to require a model dependency with their name and in a singular attempt for their name.
diff --git a/actionpack/Rakefile b/actionpack/Rakefile
index 345e235d52..c5b263c68b 100755
--- a/actionpack/Rakefile
+++ b/actionpack/Rakefile
@@ -8,7 +8,7 @@ require 'rake/contrib/rubyforgepublisher'
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_NAME = 'actionpack'
-PKG_VERSION = '1.0.0' + PKG_BUILD
+PKG_VERSION = '1.0.1' + PKG_BUILD
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
desc "Default Task"
diff --git a/actionpack/lib/action_controller/dependencies.rb b/actionpack/lib/action_controller/dependencies.rb
index d17369e5e1..14fb0147b6 100644
--- a/actionpack/lib/action_controller/dependencies.rb
+++ b/actionpack/lib/action_controller/dependencies.rb
@@ -32,8 +32,9 @@ module ActionController #:nodoc:
# observer :project_change_observer
# end
#
- # Please note that a controller like ApplicationController will automatically attempt to require_dependency on a model of its name and a helper
- # of its name. If nothing is found, no error is raised. This is especially useful for concrete controllers like PostController:
+ # Please note that a controller like ApplicationController will automatically attempt to require_dependency on a model of its
+ # singuralized name and a helper of its name. If nothing is found, no error is raised. This is especially useful for concrete
+ # controllers like PostController:
#
# class PostController < ApplicationController
# # model :post (already required)
@@ -94,8 +95,8 @@ module ActionController #:nodoc:
def inherited(child)
inherited_without_model(child)
+ return if child.controller_name == "application" # otherwise the ApplicationController in Rails will include itself
begin
- child.model(child.controller_name)
child.model(Inflector.singularize(child.controller_name))
rescue LoadError
# No neither singular or plural model available for this controller
@@ -103,4 +104,4 @@ module ActionController #:nodoc:
end
end
end
-end
+end \ No newline at end of file