I discovered application templates today, and I’ve been banging my head against the wall for an hour now about generating a one-line migration.
g = Rails::Generators::Base.new g.extend Rails::Generators::Migration g.instance_variable_set(:@source_paths, [File.expand_path(File.dirname(FILE))])
g.migration_template “migrations/enable_uuid.rb”, “db/migrate/enable_uuid.rb”
``
Seems to me like there should be an easy API endpoint about generating migrations. (I would’ve used the generator, but my migration doesn’t fit the generator invocation, it’s about enabling a DB extension)