Changeset 7383
- Timestamp:
- 08/31/07 19:07:42 (1 year ago)
- Files:
-
- trunk/actionpack/lib/action_controller/assertions.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cookies.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/flash.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/helpers.rb (modified) (7 diffs)
- trunk/actionpack/lib/action_controller/integration.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/assertions.rb
r6056 r7383 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 # trunk/actionpack/lib/action_controller/cookies.rb
r7160 r7383 45 45 end 46 46 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).47 # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using cookies[]= 48 # (for simple name/value cookies without options). 49 49 def [](name) 50 50 @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) trunk/actionpack/lib/action_controller/flash.rb
r6887 r7383 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 trunk/actionpack/lib/action_controller/helpers.rb
r7363 r7383 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 # … … 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 … … 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 # … … 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 } … … 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 … … 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| … … 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}=") } trunk/actionpack/lib/action_controller/integration.rb
r6816 r7383 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!