Changeset 6750
- Timestamp:
- 05/17/07 20:48:47 (1 year ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/base.rb (modified) (1 diff)
- trunk/actionpack/test/controller/new_render_test.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r6740 r6750 1 1 *SVN* 2 3 * Added url_for usage on render :location, which allows for record identification [DHH]. Example: 4 5 render :xml => person, :status => :created, :location => person 6 7 ...expands the location to person_url(person). 2 8 3 9 * Introduce the request.body stream. Lazy-read to parse parameters rather than always setting RAW_POST_DATA. Reduces the memory footprint of large binary PUT requests. [Jeremy Kemper] trunk/actionpack/lib/action_controller/base.rb
r6736 r6750 776 776 777 777 if location = options[:location] 778 response.headers["Location"] = location778 response.headers["Location"] = url_for(location) 779 779 end 780 780 trunk/actionpack/test/controller/new_render_test.rb
r6574 r6750 1 1 require File.dirname(__FILE__) + '/../abstract_unit' 2 2 3 silence_warnings { Customer = Struct.new("Customer", :name) } 3 silence_warnings { Customer = Struct.new(:name, :id) } 4 5 class CustomersController < ActionController::Base 6 end 4 7 5 8 module Fun … … 261 264 def render_with_location 262 265 render :xml => "<hello/>", :location => "http://example.com", :status => 201 266 end 267 268 def render_with_object_location 269 customer = Customer.new("Some guy", 1) 270 render :xml => "<customer/>", :location => customer_url(customer), :status => :created 263 271 end 264 272 … … 767 775 assert_equal "<i-am-xml/>", @response.body 768 776 end 777 778 def test_rendering_with_object_location_should_set_header_with_url_for 779 ActionController::Routing::Routes.draw do |map| 780 map.resources :customers 781 map.connect ':controller/:action/:id' 782 end 783 784 get :render_with_object_location 785 assert_equal "http://test.host/customers/1", @response.headers["Location"] 786 end 769 787 end