Permalink
Browse files

Fixed a bug that would cause an ApplicationController to require itse…

…lf 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
  • Loading branch information...
1 parent df1c699 commit f918d40ee610cedb87f54ebdcaa9233889a145f8 @dhh dhh committed Dec 17, 2004
Showing with 11 additions and 5 deletions.
  1. +5 −0 actionpack/CHANGELOG
  2. +1 −1 actionpack/Rakefile
  3. +5 −4 actionpack/lib/action_controller/dependencies.rb
View
@@ -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.
View
@@ -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"
@@ -32,8 +32,9 @@ def self.append_features(base)
# 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,13 +95,13 @@ def require_dependencies(layer, dependencies)
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
end
end
end
end
-end
+end

0 comments on commit f918d40

Please sign in to comment.