Class: ActivityNotification::Generators::MigrationGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/activity_notification/migration/migration_generator.rb

Overview

Migration generator to create migration files from templates.

Examples:

Run migration generator

rails generate activity_notification:migration

Constant Summary collapse

MIGRATION_TABLES =
['notifications', 'subscriptions'].freeze

Instance Method Summary collapse

Instance Method Details

#create_migrationsObject

Create migration files in application directory



19
20
21
22
23
# File 'lib/generators/activity_notification/migration/migration_generator.rb', line 19

def create_migrations
  @migration_name = name
  @migration_tables = options[:tables] || MIGRATION_TABLES
  migration_template 'migration.rb', "db/migrate/#{name.underscore}.rb"
end