Skip to content

Instantly share code, notes, and snippets.

View cluesque's full-sized avatar

Bill Kirtley cluesque

View GitHub Profile
# A migration that will continue to work after refactoring
class FutureProofMigration < ActiveRecord::Migration
# Redefine models used in the migration as empty inner classes. This removes all validations and magic.
class Model < ActiveRecord::Base; end
# Either don't rely on associations or declare them as referring to the new inner class
class DependentModel < ActiveRecord::Base
belongs_to :model, :class_name => "FutureProofMigration::Model"
end