Class: Geocoder::Generators::Maxmind::GeoliteCityGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Geocoder::Generators::Maxmind::GeoliteCityGenerator
- Includes:
- Geocoder::Generators::MigrationVersion, Rails::Generators::Migration
- Defined in:
- lib/generators/geocoder/maxmind/geolite_city_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Define the next_migration_number method (necessary for the migration_template method to work).
Instance Method Summary collapse
Methods included from Geocoder::Generators::MigrationVersion
Class Method Details
.next_migration_number(dirname) ⇒ Object
Define the next_migration_number method (necessary for the migration_template method to work)
19 20 21 22 23 24 25 26 |
# File 'lib/generators/geocoder/maxmind/geolite_city_generator.rb', line 19 def self.next_migration_number(dirname) if ActiveRecord::Base. sleep 1 # make sure each time we get a different timestamp Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end |
Instance Method Details
#copy_migration_files ⇒ Object
13 14 15 |
# File 'lib/generators/geocoder/maxmind/geolite_city_generator.rb', line 13 def copy_migration_files migration_template "migration/geolite_city.rb", "db/migrate/geocoder_maxmind_geolite_city.rb" end |