require 'rails/generators' require 'rails/generators/migration' module QuestSearch module Generators class MigrationGenerator < Rails::Generators::NamedBase desc "Generates migration file for the given model name" include Rails::Generators::Migration source_root File.expand_path('../../../templates', __FILE__) def self.next_migration_number(dirname) Time.now.strftime("%Y%m%d%H%M%S") end def create_migration migration_template "add_quest_search_index.rb", "db/migrate/add_quest_search_index_to_#{class_name.underscore}.rb" end end end end