3411: set default collection expiration policy
[arvados.git] / services / api / app / models / collection.rb
index 84101ffdd44424363ed91bfb4d42bf97a1c09bd6..d7cd9a2802f2d5dec60585ec084e70088ac08953 100644 (file)
@@ -10,6 +10,9 @@ class Collection < ArvadosModel
   before_validation :set_portable_data_hash
   validate :ensure_hash_matches_manifest_text
 
+  # Query only undeleted collections by default.
+  default_scope { where("expires_at IS NULL or expires_at > CURRENT_TIMESTAMP") }
+
   api_accessible :user, extend: :common do |t|
     t.add :name
     t.add :description