Migrations: determine migration number in self.up()?

Hi Joshua,

I need to know the number of a migration within the self.up() method, and I DON'T WANT TO RELY ON THE FILENAME (XXX_my_migration.rb).

So is there a way to determine it somehow?

def self.up   puts 'doing migration number ' + migration_number() end

Not so nice, but you can try that :

def self.up   puts "doing migration number : #{::ActiveRecord::Migrator.current_version}" end

   -- Jean-François.