Skip to content

Instantly share code, notes, and snippets.

@brunoarueira
Created April 20, 2012 12:28
Show Gist options
  • Save brunoarueira/2428195 to your computer and use it in GitHub Desktop.
Save brunoarueira/2428195 to your computer and use it in GitHub Desktop.
class ComentariosLegadosMigrations < ActiveRecord::Migration
MIGRATIONS_PATH='db/migrate/comentarios_legados_migrations'
def self.up
Dir["#{MIGRATIONS_PATH}/[0-9]*_*.rb"].
sort.map{|filename|require filename}.flatten.
each{|class_name| const_get(class_name).up}
end
def self.down
Dir["#{MIGRATIONS_PATH}/[0-9]*_*.rb"].sort.reverse.
map{|filename|require filename}.flatten.
each{|class_name| const_get(class_name).down}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment