This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
desc "Install/reinstall the metropoli tables in the database" | |
task :metropoli => :environment do | |
require 'yaml' | |
[Country, Region, City].each(&:delete_all) | |
p 'Deleted previous metropoli entries.' | |
path = Rails.root.join('metropoli', 'data') | |
Dir.open(path).each do |file| | |
next if [".", ".."].include?(file) | |
if file.split('.')[-1] == "yml" |
NewerOlder