Class: ChinaGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- ChinaGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/china/china_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/generators/china/china_generator.rb', line 18 def self.next_migration_number(path) unless @prev_migration_nr @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i else @prev_migration_nr += 1 end @prev_migration_nr.to_s end |
Instance Method Details
#generate_migration ⇒ Object
13 14 15 16 |
# File 'lib/generators/china/china_generator.rb', line 13 def generate_migration migration_template 'create_china_cities.rb', "db/migrate/create_sharp_cities.rb" migration_template 'import_china_cities.rb', "db/migrate/import_china_cities.rb" end |
#generate_model ⇒ Object
9 10 11 |
# File 'lib/generators/china/china_generator.rb', line 9 def generate_model copy_file 'china_city.rb', "app/models/china_city.rb" end |