Changeset 6703
- Timestamp:
- 05/09/07 03:51:06 (1 year ago)
- Files:
-
- trunk/activeresource/CHANGELOG (modified) (1 diff)
- trunk/activeresource/lib/active_resource/base.rb (modified) (2 diffs)
- trunk/activeresource/test/base_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activeresource/CHANGELOG
r6646 r6703 1 1 *SVN* 2 3 * Handle string and symbol param keys when splitting params into prefix params and query params. 4 5 Comment.find(:all, :params => { :article_id => 5, :page => 2 }) or Comment.find(:all, :params => { 'article_id' => 5, :page => 2 }) 2 6 3 7 * Added find-one with symbol [DHH]. Example: Person.find(:one, :from => :leader) # => GET /people/leader.xml trunk/activeresource/lib/active_resource/base.rb
r6657 r6703 216 216 217 217 (options || {}).each do |key, value| 218 (prefix_parameters.include?(key) ? prefix_options : query_options)[key] = value 218 next if key.blank? 219 (prefix_parameters.include?(key.to_sym) ? prefix_options : query_options)[key.to_sym] = value 219 220 end 220 221 … … 361 362 if response['Content-size'] != "0" && response.body.strip.size > 0 362 363 load(connection.xml_from_response(response)) 363 end 364 end 364 365 end 365 366 trunk/activeresource/test/base_test.rb
r6657 r6703 110 110 def test_custom_element_path 111 111 assert_equal '/people/1/addresses/1.xml', StreetAddress.element_path(1, :person_id => 1) 112 assert_equal '/people/1/addresses/1.xml', StreetAddress.element_path(1, 'person_id' => 1) 112 113 end 113 114 114 115 def test_custom_element_path_with_parameters 115 116 assert_equal '/people/1/addresses/1.xml?type=work', StreetAddress.element_path(1, :person_id => 1, :type => 'work') 117 assert_equal '/people/1/addresses/1.xml?type=work', StreetAddress.element_path(1, 'person_id' => 1, :type => 'work') 116 118 assert_equal '/people/1/addresses/1.xml?type=work', StreetAddress.element_path(1, :type => 'work', :person_id => 1) 117 119 assert_equal '/people/1/addresses/1.xml?type%5B%5D=work&type%5B%5D=play+time', StreetAddress.element_path(1, :person_id => 1, :type => ['work', 'play time']) … … 124 126 def test_custom_collection_path 125 127 assert_equal '/people/1/addresses.xml', StreetAddress.collection_path(:person_id => 1) 128 assert_equal '/people/1/addresses.xml', StreetAddress.collection_path('person_id' => 1) 126 129 end 127 130 128 131 def test_custom_collection_path_with_parameters 129 132 assert_equal '/people/1/addresses.xml?type=work', StreetAddress.collection_path(:person_id => 1, :type => 'work') 133 assert_equal '/people/1/addresses.xml?type=work', StreetAddress.collection_path('person_id' => 1, :type => 'work') 130 134 end 131 135