123456789_123456789_123456789_123456789_123456789_

Module: Rails::Generators::Migration::ClassMethods

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: railties/lib/rails/generators/migration.rb

Instance Method Summary

Instance Method Details

#current_migration_number(dirname)

[ GitHub ]

  
# File 'railties/lib/rails/generators/migration.rb', line 24

def current_migration_number(dirname)
  migration_lookup_at(dirname).collect do |file|
    File.basename(file).split("_").first.to_i
  end.max.to_i
end

#migration_exists?(dirname, file_name) ⇒ Boolean

[ GitHub ]

  
# File 'railties/lib/rails/generators/migration.rb', line 20

def migration_exists?(dirname, file_name)
  migration_lookup_at(dirname).grep(/\d+_#{file_name}.rb$/).first
end

#migration_lookup_at(dirname)

[ GitHub ]

  
# File 'railties/lib/rails/generators/migration.rb', line 16

def migration_lookup_at(dirname)
  Dir.glob("#{dirname}/[0-9]*_*.rb")
end

#next_migration_number(dirname)

Raises:

  • (NotImplementedError)
[ GitHub ]

  
# File 'railties/lib/rails/generators/migration.rb', line 30

def next_migration_number(dirname)
  raise NotImplementedError
end