summaryrefslogtreecommitdiff
path: root/users/app/models/token.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/models/token.rb')
-rw-r--r--users/app/models/token.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/users/app/models/token.rb b/users/app/models/token.rb
index 001eb40..4856c31 100644
--- a/users/app/models/token.rb
+++ b/users/app/models/token.rb
@@ -40,6 +40,14 @@ class Token < CouchRest::Model::Base
end
end
+ # Tokens can be cleaned up in different ways.
+ # So let's make sure we don't crash if they disappeared
+ def destroy_with_rescue
+ destroy_without_rescue
+ rescue RestClient::ResourceNotFound
+ end
+ alias_method_chain :destroy, :rescue
+
def touch
self.last_seen_at = Time.now
save