Ticket #9454: action_controller_docs_typos_fixed.2.diff
| File action_controller_docs_typos_fixed.2.diff, 6.2 kB (added by kampers, 1 year ago) |
|---|
-
actionpack/lib/action_controller/assertions.rb
old new 39 39 # 40 40 # == Testing named routes 41 41 # 42 # If you're using named routes, they can be easily tested using the original named routes methods straight in the test case.42 # If you're using named routes, they can be easily tested using the original named routes' methods straight in the test case. 43 43 # Example: 44 44 # 45 45 # assert_redirected_to page_url(:title => 'foo') -
actionpack/lib/action_controller/integration.rb
old new 51 51 # A reference to the response instance used by the last request. 52 52 attr_reader :response 53 53 54 # Create an initialize a new Sessioninstance.54 # Create and initialize a new +Session+ instance. 55 55 def initialize 56 56 reset! 57 57 end -
actionpack/lib/action_controller/cookies.rb
old new 44 50 update(@cookies) 45 51 end 46 52 47 # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using either the cookie method48 # or cookies[]=(for simple name/value cookies without options).53 # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using cookies[]= 54 # (for simple name/value cookies without options). 49 55 def [](name) 50 56 @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) 51 57 end -
actionpack/lib/action_controller/flash.rb
old new 96 96 use(k, false) 97 97 end 98 98 99 # Marks the entire flash or a single flash entry to be discarded by the end of the current action 99 # Marks the entire flash or a single flash entry to be discarded by the end of the current action: 100 100 # 101 101 # flash.discard # discard the entire flash at the end of the current action 102 102 # flash.discard(:warning) # discard only the "warning" entry at the end of the current action -
actionpack/lib/action_controller/helpers.rb
old new 19 19 end 20 20 21 21 # The Rails framework provides a large number of helpers for working with +assets+, +dates+, +forms+, 22 # +numbers+ and <tt>Active Record objects</tt>, to name a few.These helpers are available to all templates22 # +numbers+ and +ActiveRecord+ objects, to name a few. These helpers are available to all templates 23 23 # by default. 24 24 # 25 25 # In addition to using the standard template helpers provided in the Rails framework, creating custom helpers to 26 26 # extract complicated logic or reusable functionality is strongly encouraged. By default, the controller will 27 27 # include a helper whose name matches that of the controller, e.g., <tt>MyController</tt> will automatically 28 # include <tt>MyHelper</tt>. 28 # include <tt>MyHelper</tt>. 29 29 # 30 30 # Additional helpers can be specified using the +helper+ class method in <tt>ActionController::Base</tt> or any 31 # controller which inherits from it. 31 # controller which inherits from it. 32 32 # 33 33 # ==== Examples 34 34 # The +to_s+ method from the +Time+ class can be wrapped in a helper method to display a custom message if … … 88 88 # helper FooHelper # => includes FooHelper 89 89 # 90 90 # When the argument is the symbol <tt>:all</tt>, the controller will includes all helpers from 91 # <tt>app/views/helpers/**/*.rb</tt> under RAILS_ROOT91 # <tt>app/views/helpers/**/*.rb</tt> under +RAILS_ROOT+. 92 92 # helper :all 93 93 # 94 94 # Additionally, the +helper+ class method can receive and evaluate a block, making the methods defined available … … 102 102 # end 103 103 # end 104 104 # 105 # Finally, all the above styles can be mixed together, and the helpermethod can be invokved with a mix of105 # Finally, all the above styles can be mixed together, and the +helper+ method can be invokved with a mix of 106 106 # +symbols+, +strings+, +modules+ and blocks. 107 107 # helper(:three, BlindHelper) { def mice() 'mice' end } 108 108 # … … 139 139 master_helper_module.module_eval(&block) if block_given? 140 140 end 141 141 142 # Declare a controller method as a helper. For example, 142 # Declare a controller method as a helper. For example, the following 143 # makes the +current_user+ controller method available to the view: 143 144 # class ApplicationController < ActionController::Base 144 145 # helper_method :current_user 145 146 # def current_user 146 147 # @current_user ||= User.find(session[:user]) 147 148 # end 148 149 # end 149 # makes the +current_user+ controller method available in the view.150 150 def helper_method(*methods) 151 151 methods.flatten.each do |method| 152 152 master_helper_module.module_eval <<-end_eval … … 157 157 end 158 158 end 159 159 160 # Declare a controller attribute as a helper. For example, 160 # Declares helper accessors for controller attributes. For example, the 161 # following adds new +name+ and <tt>name=</tt> instance methods to a 162 # controller and makes them available to the view: 161 163 # helper_attr :name 162 164 # attr_accessor :name 163 # makes the name and name= controller methods available in the view.164 # The is a convenience wrapper for helper_method.165 165 def helper_attr(*attrs) 166 166 attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") } 167 167 end