aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2008-11-12 21:45:51 +1030
committerRyan Bigg <radarlistener@gmail.com>2008-11-12 21:45:51 +1030
commit451969f57a6dfee8537fb10d179514e011559111 (patch)
tree1857b9fc07a56c06a9f97fe4de8dc4554fd8a489 /activeresource
parent7f023b5e3bd62c1f91ee341c1af155c0953e693a (diff)
parentef3672dddaf6171b2fd9ef5ecc4458e0349a486f (diff)
downloadrails-451969f57a6dfee8537fb10d179514e011559111.tar.gz
rails-451969f57a6dfee8537fb10d179514e011559111.tar.bz2
rails-451969f57a6dfee8537fb10d179514e011559111.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/CHANGELOG5
-rw-r--r--activeresource/lib/active_resource/custom_methods.rb2
-rw-r--r--activeresource/test/base/custom_methods_test.rb2
3 files changed, 8 insertions, 1 deletions
diff --git a/activeresource/CHANGELOG b/activeresource/CHANGELOG
index 74ca71f65a..114a63c415 100644
--- a/activeresource/CHANGELOG
+++ b/activeresource/CHANGELOG
@@ -1,3 +1,8 @@
+*2.2.1 [RC2 or 2.2 final]*
+
+* Fixed that ActiveResource#post would post an empty string when it shouldn't be posting anything #525 [Paolo Angelini]
+
+
*2.2.0 [RC1] (October 24th, 2008)*
* Add ActiveResource::Base#to_xml and ActiveResource::Base#to_json. #1011 [Rasik Pandey, Cody Fauser]
diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb
index 24306f251d..4647e8342c 100644
--- a/activeresource/lib/active_resource/custom_methods.rb
+++ b/activeresource/lib/active_resource/custom_methods.rb
@@ -90,7 +90,7 @@ module ActiveResource
end
def post(method_name, options = {}, body = nil)
- request_body = body.nil? ? encode : body
+ request_body = body.blank? ? encode : body
if new?
connection.post(custom_method_new_element_url(method_name, options), request_body, self.class.headers)
else
diff --git a/activeresource/test/base/custom_methods_test.rb b/activeresource/test/base/custom_methods_test.rb
index ba5799edfb..61887f4ec7 100644
--- a/activeresource/test/base/custom_methods_test.rb
+++ b/activeresource/test/base/custom_methods_test.rb
@@ -81,6 +81,8 @@ class CustomMethodsTest < Test::Unit::TestCase
# Test POST against a new element URL
ryan = Person.new(:name => 'Ryan')
assert_equal ActiveResource::Response.new(@ryan, 201, {'Location' => '/people/5.xml'}), ryan.post(:register)
+ expected_request = ActiveResource::Request.new(:post, '/people/new/register.xml', @ryan)
+ assert_equal expected_request.body, ActiveResource::HttpMock.requests.first.body
# Test POST against a nested collection URL
addy = StreetAddress.new(:street => '123 Test Dr.', :person_id => 1)