Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4948

Show
Ignore:
Timestamp:
09/03/06 23:08:43 (2 years ago)
Author:
david
Message:

Deprecated all of ActionController::Dependencies. All dependency loading is now handled from Active Support [DHH]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r4929 r4948  
    11*SVN* 
     2 
     3* Deprecated all of ActionController::Dependencies. All dependency loading is now handled from Active Support [DHH] 
    24 
    35* Added assert_select* for CSS selector-based testing (deprecates assert_tag) #5936 [assaf.arkin@gmail.com] 
  • trunk/actionpack/lib/action_controller.rb

    r4922 r4948  
    4444require 'action_controller/filters' 
    4545require 'action_controller/layout' 
    46 require 'action_controller/dependencies' 
     46require 'action_controller/deprecated_dependencies' 
    4747require 'action_controller/mime_responds' 
    4848require 'action_controller/pagination' 
  • trunk/actionpack/lib/action_controller/deprecated_dependencies.rb

    r4885 r4948  
    55    end 
    66 
    7     # Dependencies control what classes are needed for the controller to run its course. This is an alternative to doing explicit 
    8     # +require+ statements that bring a number of benefits. It's more succinct, communicates what type of dependency we're talking about, 
    9     # can trigger special behavior (as in the case of +observer+), and enables Rails to be clever about reloading in cached environments 
    10     # like FCGI. Example: 
    11     # 
    12     #   class ApplicationController < ActionController::Base 
    13     #     model    :account, :company, :person, :project, :category 
    14     #     helper   :access_control 
    15     #     service  :notifications, :billings 
    16     #     observer :project_change_observer 
    17     #   end 
    18     # 
    19     # Please note that a controller like ApplicationController will automatically attempt to require_dependency on a model of its  
    20     # singuralized name and a helper of its name. If nothing is found, no error is raised. This is especially useful for concrete  
    21     # controllers like PostController: 
    22     # 
    23     #   class PostController < ApplicationController 
    24     #     # model  :post (already required) 
    25     #     # helper :post (already required) 
    26     #   end 
    27     # 
    28     # 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 
    29     # classes don't have to be required as Active Support will auto-require them. 
     7    # Deprecated module. The responsibility of loading dependencies belong with Active Support now. 
    308    module ClassMethods #:nodoc: 
    319      # Specifies a variable number of models that this controller depends on. Models are normally Active Record classes or a similar 
     
    3513        depend_on(:model, models) 
    3614      end 
     15      deprecate :model 
    3716 
    3817      # Specifies a variable number of services that this controller depends on. Services are normally singletons or factories, like 
     
    4221        depend_on(:service, services) 
    4322      end 
     23      deprecate :service 
    4424       
    4525      # Specifies a variable number of observers that are to govern when this controller is handling actions. The observers will 
     
    5030        instantiate_observers(observers) 
    5131      end 
     32      deprecate :observer 
    5233 
    5334      # Returns an array of symbols that specify the dependencies on a given layer. For the example at the top, calling 
     
    5637        read_inheritable_attribute("#{layer}_dependencies") 
    5738      end 
    58      
     39      deprecate :dependencies_on 
     40 
    5941      def depend_on(layer, dependencies) #:nodoc: 
    6042        write_inheritable_array("#{layer}_dependencies", dependencies) 
    6143      end 
     44      deprecate :depend_on 
    6245 
    6346      private