aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib
diff options
context:
space:
mode:
authorJordan Brough <jordan@animoto.com>2009-08-09 22:53:04 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-08-09 22:56:32 +0100
commit916b18adeb0a1ae09fdaff21dda8d0bc8ed4ffa9 (patch)
treebc38926bdaa604240e1688884b56d09a14a5f660 /activeresource/lib
parent1af9bd58a04d14dc727713d2e581fafebc0e1d96 (diff)
downloadrails-916b18adeb0a1ae09fdaff21dda8d0bc8ed4ffa9.tar.gz
rails-916b18adeb0a1ae09fdaff21dda8d0bc8ed4ffa9.tar.bz2
rails-916b18adeb0a1ae09fdaff21dda8d0bc8ed4ffa9.zip
Active Resource recognizes 410 as Resource Gone now [#2316 state:resolved] [Jordan Brough, Jatinder Singh]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activeresource/lib')
-rw-r--r--activeresource/lib/active_resource/base.rb3
-rw-r--r--activeresource/lib/active_resource/connection.rb2
-rw-r--r--activeresource/lib/active_resource/exceptions.rb3
3 files changed, 7 insertions, 1 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index a66ce4c23f..0311419fd6 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -164,6 +164,7 @@ module ActiveResource
# * 404 - ActiveResource::ResourceNotFound
# * 405 - ActiveResource::MethodNotAllowed
# * 409 - ActiveResource::ResourceConflict
+ # * 410 - ActiveResource::ResourceGone
# * 422 - ActiveResource::ResourceInvalid (rescued by save as validation errors)
# * 401..499 - ActiveResource::ClientError
# * 500..599 - ActiveResource::ServerError
@@ -626,7 +627,7 @@ module ActiveResource
response.code.to_i == 200
end
# id && !find_single(id, options).nil?
- rescue ActiveResource::ResourceNotFound
+ rescue ActiveResource::ResourceNotFound, ActiveResource::ResourceGone
false
end
diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb
index 884c425c1d..9d551f04e7 100644
--- a/activeresource/lib/active_resource/connection.rb
+++ b/activeresource/lib/active_resource/connection.rb
@@ -131,6 +131,8 @@ module ActiveResource
raise(MethodNotAllowed.new(response))
when 409
raise(ResourceConflict.new(response))
+ when 410
+ raise(ResourceGone.new(response))
when 422
raise(ResourceInvalid.new(response))
when 401...500
diff --git a/activeresource/lib/active_resource/exceptions.rb b/activeresource/lib/active_resource/exceptions.rb
index dd59146b1a..0631cdcf9f 100644
--- a/activeresource/lib/active_resource/exceptions.rb
+++ b/activeresource/lib/active_resource/exceptions.rb
@@ -51,6 +51,9 @@ module ActiveResource
# 409 Conflict
class ResourceConflict < ClientError; end # :nodoc:
+ # 410 Gone
+ class ResourceGone < ClientError; end # :nodoc:
+
# 5xx Server Error
class ServerError < ConnectionError; end # :nodoc: