Skip to content

Instantly share code, notes, and snippets.

@apatten
Created February 19, 2014 23:36
Show Gist options
  • Save apatten/9103895 to your computer and use it in GitHub Desktop.
Save apatten/9103895 to your computer and use it in GitHub Desktop.
diff --git a/lib/tasks/mongo.thor b/lib/tasks/mongo.thor
index 77aa8c9..16046aa 100644
--- a/lib/tasks/mongo.thor
+++ b/lib/tasks/mongo.thor
@@ -34,7 +34,7 @@ class Mongo < Thor
print "Downloading latest backup....\n"
s3_dir = connection.directories.get("com.estimize.backup")
- latest_backup = s3_dir.files.keep_if{|o| o.key =~ /mongo_daily/}.map(&:key).sort.last
+ latest_backup = s3_dir.files.keep_if{|o| o.key =~ /mongo_daily/}.map(&:key).sort[-2]
puts "Latest backup file = #{latest_backup} ..."
s3_file = s3_dir.files.get(latest_backup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment