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

Changeset 2749

Show
Ignore:
Timestamp:
10/26/05 13:20:46 (3 years ago)
Author:
david
Message:

Fixed docs (closes #2468)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/assertions.rb

    r2635 r2749  
    99    # can be used against. These collections are: 
    1010    # 
    11     # * assigns: Instance variables assigned in the action that's available for the view. 
     11    # * assigns: Instance variables assigned in the action that are available for the view. 
    1212    # * session: Objects being saved in the session. 
    13     # * flash: The flash objects being currently in the session. 
     13    # * flash: The flash objects currently in the session. 
    1414    # * cookies: Cookies being sent to the user on this request. 
    1515    #  
     
    2626    # On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url. 
    2727    # 
    28     # For redirects within the same controller, you can even call follow_redirect and the redirect will be follow triggering another 
     28    # For redirects within the same controller, you can even call follow_redirect and the redirect will be followed, triggering another 
    2929    # action call which can then be asserted against. 
    3030    # 
    3131    # == Manipulating the request collections 
    3232    # 
    33     # The collections described above link to the response, so you can test if what the actions were expected to do happen. But 
    34     # some times you also want to manipulate these collections in the request coming in. This is really only relevant for sessions 
     33    # The collections described above link to the response, so you can test if what the actions were expected to do happened. But 
     34    # sometimes you also want to manipulate these collections in the incoming request. This is really only relevant for sessions 
    3535    # and cookies, though. For sessions, you just do: 
    3636    # 
     
    6969 
    7070      # Assert that the redirection options passed in match those of the redirect called in the latest action. This match can be partial, 
    71       # such at assert_redirected_to(:controller => "weblog") will also match the redirection of  
     71      # such that assert_redirected_to(:controller => "weblog") will also match the redirection of  
    7272      # redirect_to(:controller => "weblog", :action => "show") and so on. 
    7373      def assert_redirected_to(options = {}, message=nil) 
     
    119119      end 
    120120 
    121       # Asserts that the routing of the given path is handled correctly and that the parsed options match. 
     121      # Asserts that the routing of the given path was handled correctly and that the parsed options match. 
    122122      def assert_recognizes(expected_options, path, extras={}, message=nil) 
    123123        clean_backtrace do  
     
    160160      end 
    161161 
    162       # asserts that path and options match both ways, in other words, the URL generated from  
    163       # options is same as path, and also that the options recognized from path are same as options 
     162      # Asserts that path and options match both ways; in other words, the URL generated from  
     163      # options is the same as path, and also that the options recognized from path are the same as options 
    164164      def assert_routing(path, options, defaults={}, extras={}, message=nil) 
    165165        assert_recognizes(options, path, extras, message) 
  • trunk/actionpack/lib/action_controller/base.rb

    r2723 r2749  
    9090  # == Parameters 
    9191  # 
    92   # All request parameters whether they come from a GET or POST request, or from the URL, are available through the params hash. 
     92  # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params hash. 
    9393  # So an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 } 
    9494  # in params. 
     
    166166  #  
    167167  # This sounds fairly simple, but the redirection is complicated by the quest for a phenomenon known as "pretty urls". Instead of accepting 
    168   # the dreadful beings that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as 
     168  # the dreadful being that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as 
    169169  # "/weblog/show/5". And this is even the simple case. As an example of a more advanced pretty url consider 
    170170  # "/library/books/ISBN/0743536703/show", which can be mapped to books_controller?action=show&type=ISBN&id=0743536703. 
     
    189189  # == Calling multiple redirects or renders 
    190190  # 
    191   # An action should conclude by a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError: 
     191  # An action should conclude with a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError: 
    192192  # 
    193193  #   def do_something 
     
    242242    cattr_accessor :debug_routes 
    243243 
    244     # Controls whether the application is thread-safe, so multi-threaded servers like WEBrick knows whether to apply a mutex 
     244    # Controls whether the application is thread-safe, so multi-threaded servers like WEBrick know whether to apply a mutex 
    245245    # around the performance of each action. Action Pack and Active Record are by default thread-safe, but many applications 
    246246    # may not be. Turned off by default. 
     
    277277     
    278278    # Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person" 
    279     # key. The session will hold any type of object as values, but the key should be a string
     279    # key. The session will hold any type of object as values, but the key should be a string or symbol
    280280    attr_accessor :session 
    281281     
     
    307307      end 
    308308       
    309       # Convert the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat". 
     309      # Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat". 
    310310      def controller_path 
    311311        unless @controller_path 
     
    374374      # <tt>url_for</tt> is used to: 
    375375      #   
    376       # All keys given to url_for are forwarded to the Route module save for the following: 
     376      # All keys given to url_for are forwarded to the Route module, save for the following: 
    377377      # * <tt>:anchor</tt> -- specifies the anchor name to be appended to the path. For example,  
    378378      #   <tt>url_for :controller => 'posts', :action => 'show', :id => 10, :anchor => 'comments'</tt>  
     
    409409      # route given by <tt>map.connect 'people/:last/:first/:action', :action => 'bio', :controller => 'people'</tt>. 
    410410      # 
    411       # Suppose that the current URL is "people/hh/david/contacts". Let's consider a few different cases URLs which are generated 
     411      # Suppose that the current URL is "people/hh/david/contacts". Let's consider a few different cases of URLs which are generated 
    412412      # from this page. 
    413413      # 
     
    437437      # 
    438438      # This takes the current URL as is and only exchanges the action. In contrast, <tt>url_for :action => 'print'</tt> 
    439       # would have slashed-off the path components are the changed action. 
     439      # would have slashed-off the path components after the changed action. 
    440440      def url_for(options = {}, *parameters_for_method_reference) #:doc: 
    441441        case options 
     
    482482      # === Rendering partials 
    483483      #  
    484       # Partial rendering is most commonly used together with Ajax calls that only updates one or a few elements on a page 
     484      # Partial rendering is most commonly used together with Ajax calls that only update one or a few elements on a page 
    485485      # without reloading. Rendering of partials from the controller makes it possible to use the same partial template in 
    486486      # both the full-page rendering (by calling it from within the template) and when sub-page updates happen (from the 
     
    684684      end 
    685685 
    686       # Clears the redirected results from the headers, resetting the status to 200 and returns  
     686      # Clears the redirected results from the headers, resets the status to 200 and returns  
    687687      # the URL that was used to redirect or nil if there was no redirected URL 
    688688      # Note that +redirect_to+ will change the body of the response to indicate a redirection. 
  • trunk/actionpack/lib/action_controller/caching.rb

    r2649 r2749  
    1919 
    2020    # Page caching is an approach to caching where the entire action output of is stored as a HTML file that the web server  
    21     # can serve without going through the Action Pack. This can be as much as 100 times faster than going the process of dynamically 
     21    # can serve without going through the Action Pack. This can be as much as 100 times faster than going through the process of dynamically 
    2222    # generating the content. Unfortunately, this incredible speed-up is only available to stateless pages where all visitors 
    2323    # are treated the same. Content management systems -- including weblogs and wikis -- have many pages that are a great fit 
     
    141141    # Action caching is similar to page caching by the fact that the entire output of the response is cached, but unlike page caching,  
    142142    # every request still goes through the Action Pack. The key benefit of this is that filters are run before the cache is served, which 
    143     # allows for authentication and other restrictions on whether someone are supposed to see the cache. Example: 
     143    # allows for authentication and other restrictions on whether someone is allowed to see the cache. Example: 
    144144    # 
    145145    #   class ListsController < ApplicationController 
     
    229229    # of which there are four different kinds: 
    230230    # 
    231     # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and share the fragments for 
     231    # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and shares the fragments for 
    232232    #   all the web server processes running off the same application directory. 
    233233    # * MemoryStore: Keeps the fragments in memory, which is fine for WEBrick and for FCGI (if you don't care that each FCGI process holds its 
     
    482482    #   end 
    483483    # 
    484     # The sweeper is assigned on the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method: 
     484    # The sweeper is assigned in the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method: 
    485485    # 
    486486    #   class ListsController < ApplicationController 
     
    489489    #   end 
    490490    # 
    491     # In the example above, four actions are cached and three actions are responsible of expiring those caches. 
     491    # In the example above, four actions are cached and three actions are responsible for expiring those caches. 
    492492    module Sweeping 
    493493      def self.append_features(base) #:nodoc: 
  • trunk/actionpack/lib/action_controller/components.rb

    r2722 r2749  
    11module ActionController #:nodoc: 
    2   # Components allows you to call other actions for their rendered response while execution another action. You can either delegate 
     2  # Components allows you to call other actions for their rendered response while executing another action. You can either delegate 
    33  # the entire response rendering or you can mix a partial response in with your other content. 
    44  # 
  • trunk/actionpack/lib/action_controller/cookies.rb

    r1350 r2749  
    11module ActionController #:nodoc: 
    2   # Cookies are read and written through ActionController#cookies. The cookies being read is what was received along with the request, 
    3   # the cookies being written is what will be sent out will the response. Cookies are read by value (so you won't get the cookie object 
     2  # Cookies are read and written through ActionController#cookies. The cookies being read are what were received along with the request, 
     3  # the cookies being written are what will be sent out with the response. Cookies are read by value (so you won't get the cookie object 
    44  # itself back -- just the value it holds). Examples for writing: 
    55  # 
     
    4444    end 
    4545 
    46     # Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method 
     46    # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using either the cookie method 
    4747    # or cookies[]= (for simple name/value cookies without options). 
    4848    def [](name) 
  • trunk/actionpack/lib/action_controller/dependencies.rb

    r1819 r2749  
    2828    # 
    2929    # 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 
    30     # classes doesn't have to be required as Active Support will auto-require them. 
     30    # classes don't have to be required as Active Support will auto-require them. 
    3131    module ClassMethods 
    3232      # Specifies a variable number of models that this controller depends on. Models are normally Active Record classes or a similar 
  • trunk/actionpack/lib/action_controller/filters.rb

    r1936 r2749  
    4242    # Now any actions performed on the BankController will have the audit method called before. On the VaultController, 
    4343    # first the audit method is called, then the verify_credentials method. If the audit method returns false, then  
    44     # verify_credentials and the intended action is never called. 
     44    # verify_credentials and the intended action are never called. 
    4545    # 
    4646    # == Filter types 
     
    7575    # As you can see, the block expects to be passed the controller after it has assigned the request to the internal variables. 
    7676    # This means that the block has access to both the request and response objects complete with convenience methods for params, 
    77     # session, template, and assigns. Note: The inline method doesn't strictly has to be a block. Any object that responds to call 
     77    # session, template, and assigns. Note: The inline method doesn't strictly have to be a block; any object that responds to call 
    7878    # and returns 1 or -1 on arity will do (such as a Proc or an Method object). 
    7979    # 
     
    144144    #   end 
    145145    #  
    146     # When setting conditions on inline method (proc) filters the condition must come first and be placed in parenthesis. 
     146    # When setting conditions on inline method (proc) filters the condition must come first and be placed in parentheses. 
    147147    # 
    148148    #   class UserPreferences < ActionController::Base 
  • trunk/actionpack/lib/action_controller/helpers.rb

    r2197 r2749  
    2020    end 
    2121 
    22     # The template helpers serves to relieve the templates from including the same inline code again and again. It's a 
     22    # The template helpers serve to relieve the templates from including the same inline code again and again. It's a 
    2323    # set of standardized methods for working with forms (FormHelper), dates (DateHelper), texts (TextHelper), and  
    2424    # Active Records (ActiveRecordHelper) that's available to all templates by default. 
  • trunk/actionpack/lib/action_controller/layout.rb

    r1970 r2749  
    2525    # 
    2626    # With layouts, you can flip it around and have the common structure know where to insert changing content. This means 
    27     # that the header and footer is only mentioned in one place, like this: 
     27    # that the header and footer are only mentioned in one place, like this: 
    2828    # 
    2929    #   <!-- The header part of this layout --> 
  • trunk/actionpack/lib/action_controller/rescue.rb

    r1952 r2749  
    5757      end 
    5858 
    59       # Overwrite to expand the meaning of a local request in order to show local rescues on other occurences than 
     59      # Overwrite to expand the meaning of a local request in order to show local rescues on other occurrences than 
    6060      # the remote IP being 127.0.0.1. For example, this could include the IP of the developer machine when debugging 
    6161      # remotely.