Class: Geocoder::Generators::Maxmind::GeoliteCityGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/geocoder/maxmind/geolite_city_generator.rb

Class Method Summary collapse

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_city_generator.rb', line 17

def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    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_filesObject


11
12
13
# File 'lib/generators/geocoder/maxmind/geolite_city_generator.rb', line 11

def copy_migration_files
  migration_template "migration/geolite_city.rb", "db/migrate/geocoder_maxmind_geolite_city.rb"
end