Browse files

Add Base.delete for deleting resources without having to instantiate …

…them first

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5229 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 54e86cc commit 6c0609fafb387f2f61ba9eb9754c31bdebeb46ec @jamis jamis committed Oct 6, 2006
Showing with 10 additions and 0 deletions.
  1. +2 −0 activeresource/CHANGELOG
  2. +4 −0 activeresource/lib/active_resource/base.rb
  3. +4 −0 activeresource/test/base_test.rb
View
2 activeresource/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Add Base.delete for deleting resources without having to instantiate them first. [Jamis Buck]
+
* Make #save behavior mimic AR::Base#save (true on success, false on failure). [Jamis Buck]
* Add Basic HTTP Authentication to ActiveResource (closes #6305). [jonathan]
View
4 activeresource/lib/active_resource/base.rb
@@ -81,6 +81,10 @@ def find(*arguments)
end
end
+ def delete(id)
+ connection.delete(element_path(id))
+ end
+
private
# { :people => { :person => [ person1, person2 ] } }
def find_every(options)
View
4 activeresource/test/base_test.rb
@@ -167,4 +167,8 @@ def test_destroy_with_custom_prefix
end
assert_raises(ActiveResource::ResourceNotFound) { StreetAddress.find(1, :person_id => 1).destroy }
end
+
+ def test_delete
+ assert Person.delete(1)
+ end
end

0 comments on commit 6c0609f

Please sign in to comment.