Permalink
Browse files

Changed the call to .sort.last to .max when computing the migration v…

…ersion. You

do not actually need to sort everything (incurs more cost than just a
simple max).
  • Loading branch information...
1 parent 730f725 commit 7952eafcfcbfa01a0332a1d196398f42eef5127f @wangjohn wangjohn committed Mar 20, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/migration.rb
View
2 activerecord/lib/active_record/migration.rb
@@ -858,7 +858,7 @@ def initialize(direction, migrations, target_version = nil)
end
def current_version
- migrated.sort.last || 0
+ migrated.max || 0
end
def current_migration

0 comments on commit 7952eaf

Please sign in to comment.