Class: Headmin::FieldsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/headmin/fields_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



17
18
19
20
# File 'lib/generators/headmin/fields_generator.rb', line 17

def next_migration_number(dirname)
  next_migration_number = current_migration_number(dirname) + 1
  ActiveRecord::Migration.next_migration_number(next_migration_number)
end

Instance Method Details

#copy_migrationsObject



11
12
13
14
# File 'lib/generators/headmin/fields_generator.rb', line 11

def copy_migrations
  migration_template "migrations/create_fields.rb", "db/migrate/create_fields.rb"
  migration_template "migrations/create_field_hierarchies.rb", "db/migrate/create_field_hierarchies.rb"
end

#copy_modelsObject



7
8
9
# File 'lib/generators/headmin/fields_generator.rb', line 7

def copy_models
  template "models/field.rb", "app/models/field.rb"
end