Permalink
Browse files

Added documentation for ActiveRecord::Base#next_migration_number

  • Loading branch information...
aditya-kapoor committed May 9, 2013
1 parent e6cebce commit fe7cf89193bcbb92d1a4dd86e67da9627c20a167
Showing with 5 additions and 0 deletions.
  1. +5 −0 activerecord/lib/active_record/migration.rb
@@ -668,6 +668,11 @@ def copy(destination, sources, options = {})
copied
end
+ # Determines the version number of the next migration
+ # if the timestamped migrations are activated then the comparison with the current time is made
+ # and then higer of the two values is selected
+ # For non timestamped values, the simple numbers are used in the format of "057", "570"
+
def next_migration_number(number)
if ActiveRecord::Base.timestamped_migrations
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % number].max

0 comments on commit fe7cf89

Please sign in to comment.