1 2 3 4 5 6 7 8 9 10 11 12
class SessionMigrationGenerator < Rails::Generator::NamedBase def initialize(runtime_args, runtime_options = {}) runtime_args << 'add_session_table' if runtime_args.empty? super end def manifest record do |m| m.migration_template 'migration.rb', 'db/migrate' end end end