Class: ZipMetaMigrationGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ZipMetaMigrationGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/zip_meta_migration_generator.rb
Overview
Generates a timestamped migration file containing the CreateZipMetaTable migration, which creates the “zip_meta” table and populates it with data from “zipcodes.csv”, and drops this migration file into the user’s “app/db/migrations” directory.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(path) ⇒ Object
12 13 14 |
# File 'lib/generators/zip_meta_migration_generator.rb', line 12 def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end |
Instance Method Details
#create_migration_file ⇒ Object
16 17 18 |
# File 'lib/generators/zip_meta_migration_generator.rb', line 16 def create_migration_file migration_template "create_zip_meta_table.rb", "db/migrate/create_zip_meta_table.rb" end |