Class: Merb::Generators::MigrationGenerator
- Inherits:
-
Generator
- Object
- Templater::Generator
- Generator
- Merb::Generators::MigrationGenerator
show all
- Defined in:
- lib/generators/migration.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Generator
#go_up, #initialize, #with_modules
#error, #success, #warning
Class Method Details
.source_root ⇒ Object
5
6
7
|
# File 'lib/generators/migration.rb', line 5
def self.source_root
File.join(super, 'component', 'migration')
end
|
Instance Method Details
#class_name ⇒ Object
23
24
25
|
# File 'lib/generators/migration.rb', line 23
def class_name
"#{self.name.camel_case}Migration"
end
|
#file_name ⇒ Object
31
32
33
|
# File 'lib/generators/migration.rb', line 31
def file_name
"#{version}_#{migration_name}_migration"
end
|
#migration_name ⇒ Object
27
28
29
|
# File 'lib/generators/migration.rb', line 27
def migration_name
self.name.snake_case
end
|
#table_name ⇒ Object
19
20
21
|
# File 'lib/generators/migration.rb', line 19
def table_name
self.name.snake_case.pluralize
end
|
#version ⇒ Object
35
36
37
38
39
|
# File 'lib/generators/migration.rb', line 35
def version
n = options[:delete] ? current_migration_nr : current_migration_nr + 1
format("%03d", n)
end
|