Class: FeatureBox::Generators::MigrationsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
GeneratorBase
Defined in:
lib/generators/feature_box/migrations_generator.rb

Instance Method Summary collapse

Methods included from GeneratorBase

#copy_migrations, included, #trim, #trim_f

Instance Method Details

#copy_migrations_taskObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/feature_box/migrations_generator.rb', line 7

def copy_migrations_task
  
  @model_name = ask("What is the User model name? [User]")
  @model_name = "User" if @model_name.empty?
  
  migrations = eval ask("Enter migration number or range. '05' or '00..04':");
  if migrations.class == Fixnum
    copy_migration migrations
  elsif migrations.class == Range
    migrations.each do |m|
      copy_migration m
    end
  else 
    return say "Wrong format"
  end      
end