diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index d5213be69a0f42cdc246b8ca396ace6a4331214e..9e2d105a2bca921864228356a7fc07a3ca04044d 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Deprecated all of ActionController::Dependencies. All dependency loading is now handled from Active Support [DHH] + * Added assert_select* for CSS selector-based testing (deprecates assert_tag) #5936 [assaf.arkin@gmail.com] * radio_button_tag generates unique id attributes. #3353 [Bob Silva, somekool@gmail.com] diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index f020bf6dc5b68c026af2892580a6e95984f3673c..283238bb932a3d9b96d80fa4168c138edc76e8c2 100755 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -43,7 +43,7 @@ require 'action_controller/flash' require 'action_controller/filters' require 'action_controller/layout' -require 'action_controller/dependencies' +require 'action_controller/deprecated_dependencies' require 'action_controller/mime_responds' require 'action_controller/pagination' require 'action_controller/scaffolding' diff --git a/actionpack/lib/action_controller/dependencies.rb b/actionpack/lib/action_controller/deprecated_dependencies.rb similarity index 62% rename from actionpack/lib/action_controller/dependencies.rb rename to actionpack/lib/action_controller/deprecated_dependencies.rb index d316552f49e7043a50f48bdd484d38ea2ff4e6b0..433b9e5af8953dc918ef49b3c02b028c4308f729 100644 --- a/actionpack/lib/action_controller/dependencies.rb +++ b/actionpack/lib/action_controller/deprecated_dependencies.rb @@ -4,29 +4,7 @@ def self.included(base) base.extend(ClassMethods) end - # Dependencies control what classes are needed for the controller to run its course. This is an alternative to doing explicit - # +require+ statements that bring a number of benefits. It's more succinct, communicates what type of dependency we're talking about, - # can trigger special behavior (as in the case of +observer+), and enables Rails to be clever about reloading in cached environments - # like FCGI. Example: - # - # class ApplicationController < ActionController::Base - # model :account, :company, :person, :project, :category - # helper :access_control - # service :notifications, :billings - # observer :project_change_observer - # end - # - # 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) - # # helper :post (already required) - # end - # - # Also note, that if the models follow the pattern of just 1 class per file in the form of MyClass => my_class.rb, then these - # classes don't have to be required as Active Support will auto-require them. + # Deprecated module. The responsibility of loading dependencies belong with Active Support now. module ClassMethods #:nodoc: # Specifies a variable number of models that this controller depends on. Models are normally Active Record classes or a similar # backend for modelling entity classes. @@ -34,6 +12,7 @@ def model(*models) require_dependencies(:model, models) depend_on(:model, models) end + deprecate :model # Specifies a variable number of services that this controller depends on. Services are normally singletons or factories, like # Action Mailer service or a Payment Gateway service. @@ -41,6 +20,7 @@ def service(*services) require_dependencies(:service, services) depend_on(:service, services) end + deprecate :service # Specifies a variable number of observers that are to govern when this controller is handling actions. The observers will # automatically have .instance called on them to make them active on assignment. @@ -49,16 +29,19 @@ def observer(*observers) depend_on(:observer, observers) instantiate_observers(observers) end + deprecate :observer # Returns an array of symbols that specify the dependencies on a given layer. For the example at the top, calling # ApplicationController.dependencies_on(:model) would return [:account, :company, :person, :project, :category] def dependencies_on(layer) read_inheritable_attribute("#{layer}_dependencies") end - + deprecate :dependencies_on + def depend_on(layer, dependencies) #:nodoc: write_inheritable_array("#{layer}_dependencies", dependencies) end + deprecate :depend_on private def instantiate_observers(observers)