Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit f918d40ee610cedb87f54ebdcaa9233889a145f8 1 parent df1c699
@dhh dhh authored
View
5 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.
View
2  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"
View
9 actionpack/lib/action_controller/dependencies.rb
@@ -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,8 +95,8 @@ 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
@@ -103,4 +104,4 @@ def inherited(child)
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.