Last Updated: February 25, 2016
·
1.716K
· lscott3

Solve the NotImplementedError for Rails 3 generators with migrations

While making a generator/gem that relied on creating migrations I ran into this error:

`nextmigrationnumber': NotImplementedError (NotImplementedError)

After doing some searching I realized it is up to you to create this method in your generator. Here is what I am using:

def self.next_migration_number(path)
    @migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i.to_s
end