Changeset 1170
- Timestamp:
- 04/16/05 16:08:29 (4 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (2 diffs)
- trunk/actionpack/lib/action_view/partials.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r1160 r1170 1 1 *SVN* 2 3 * Changed render_partial to take local assigns as the second parameter instead of an explicit object and then the assigns. So the API changes from: 4 5 <%= render_partial "account", person, "rules" => regulations.rules %> 6 7 ...to: 8 9 <%= render_partial "account", :account => person, :rules => regulations.rules %> 10 11 The old API will still work, though, and render_partial "account" will still assume :account => @account. 2 12 3 13 * Added submit_to_remote that allows you to trigger an Ajax form submition at the click of the submission button, which allows for multiple targets in a single form through the use of multiple submit buttons #930 [yrashk@gmail.com] trunk/actionpack/lib/action_controller/base.rb
r1130 r1170 243 243 244 244 # Holds the request object that's primarily used to get environment variables through access like 245 # <tt> @request.env["REQUEST_URI"]</tt>.245 # <tt>request.env["REQUEST_URI"]</tt>. 246 246 attr_accessor :request 247 247 … … 251 251 252 252 # Holds the response object that's primarily used to set additional HTTP headers through access like 253 # <tt> @response.headers["Cache-Control"] = "no-cache"</tt>. Can also be used to access the final body HTML after a template254 # has been rendered through @response.body -- useful for <tt>after_filter</tt>s that wants to manipulate the output,253 # <tt>response.headers["Cache-Control"] = "no-cache"</tt>. Can also be used to access the final body HTML after a template 254 # has been rendered through response.body -- useful for <tt>after_filter</tt>s that wants to manipulate the output, 255 255 # such as a OutputCompressionFilter. 256 256 attr_accessor :response 257 257 258 # Holds a hash of objects in the session. Accessed like <tt> @session["person"]</tt> to get the object tied to the "person"258 # Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person" 259 259 # key. The session will hold any type of object as values, but the key should be a string. 260 260 attr_accessor :session 261 261 262 # Holds a hash of header names and values. Accessed like <tt> @headers["Cache-Control"]</tt> to get the value of the Cache-Control262 # Holds a hash of header names and values. Accessed like <tt>headers["Cache-Control"]</tt> to get the value of the Cache-Control 263 263 # directive. Values should always be specified as strings. 264 264 attr_accessor :headers trunk/actionpack/lib/action_view/partials.rb
r1169 r1170 2 2 # There's also a convenience method for rendering sub templates within the current controller that depends on a single object 3 3 # (we call this kind of sub templates for partials). It relies on the fact that partials should follow the naming convention of being 4 # prefixed with an underscore -- as to separate them from regular templates that could be rendered on their own. In the template for 5 # Advertiser#buy, we could have: 4 # prefixed with an underscore -- as to separate them from regular templates that could be rendered on their own. 5 # 6 # In a template for Advertiser#account: 7 # 8 # <%= render_partial "account" %> 9 # 10 # This would render "advertiser/_account.rhtml" and pass the instance variable @account in as a local variable +account+ to 11 # the template for display. 12 # 13 # In another template for Advertiser#buy, we could have: 14 # 15 # <%= render_partial "account", :account => @buyer %> 6 16 # 7 17 # <% for ad in @advertisements %> 8 # <%= render_partial "ad", ad %>18 # <%= render_partial "ad", :ad => ad %> 9 19 # <% end %> 10 20 # 11 # This would render "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display. 21 # This would first render "advertiser/_account.rhtml" with @buyer passed in as the local variable +account+, then render 22 # "advertiser/_ad.rhtml" and pass the local variable +ad+ to the template for display. 12 23 # 13 24 # == Rendering a collection of partials … … 28 39 # Two controllers can share a set of partials and render them like this: 29 40 # 30 # <%= render_partial "advertisement/ad", ad%>41 # <%= render_partial "advertisement/ad", :ad => @advertisement %> 31 42 # 32 43 # This will render the partial "advertisement/_ad.rhtml" regardless of which controller this is being called from.