Class: Arfy::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/arfy/generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_migration_file(migration_name, dir) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/arfy/generator.rb', line 5

def generate_migration_file(migration_name, dir)
  dir ||= Rails.application.config.paths['db/migrate']
  migration_path = File.join(dir, new_migration_file_name_for(migration_name))
  File.open(migration_path, "w") do |file|
    file << code_for_migration(migration_name)
  end
  migration_path
end