Class: Geocoder::Generators::Maxmind::GeoliteCountryGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Geocoder::Generators::Maxmind::GeoliteCountryGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/geocoder/maxmind/geolite_country_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
Class Method Details
.next_migration_number(dirname) ⇒ Object
Define the next_migration_number method (necessary for the migration_template method to work)
17 18 19 20 21 22 23 24 |
# File 'lib/generators/geocoder/maxmind/geolite_country_generator.rb', line 17 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
11 12 13 |
# File 'lib/generators/geocoder/maxmind/geolite_country_generator.rb', line 11 def copy_migration_files migration_template "migration/geolite_country.rb", "db/migrate/geocoder_maxmind_geolite_country.rb" end |