Best practice for building migration generator

2 views
Skip to first unread message

Kai Schlamp

unread,
Apr 13, 2011, 5:09:43 AM4/13/11
to Ruby on Rails: Talk
I often see different ways how migration generators are implemented
and I wonder what the recommended one at the moment is.

Currently I directly call:

ActiveRecord::Generators::Base.next_migration_number(path)

But it seems that this method is now depreciated (http://apidock.com/
rails/ActiveRecord/Generators/Base/next_migration_number/class) even
if it was just introduced as class method (https://
rails.lighthouseapp.com/projects/8994/tickets/3820-make-
railsgeneratorsmigrationnext_migration_number-method-a-class-method-so-
it-possible-to-use-it-in-custom-generators).

Is it now recommended to build the migration number manually again
(like here https://github.com/codegram/resort/blob/master/lib/generators/active_record/resort_generator.rb)?

For my full generator please see (also see for the full generator
https://github.com/medihack/make_voteable/blob/master/lib/generators/make_voteable/make_voteable_generator.rb)

Best regards,
Kai
Reply all
Reply to author
Forward
0 new messages