Skip to content

Instantly share code, notes, and snippets.

@rlburkes
Last active December 22, 2015 19:19
Show Gist options
  • Save rlburkes/6519103 to your computer and use it in GitHub Desktop.
Save rlburkes/6519103 to your computer and use it in GitHub Desktop.
class BuildPropertyAssociationsOnExports < ActiveRecord::Migration
...
class Property < ActiveRecord::Base
attr_accessible :hierarchical
end
...
def up
ActiveRecord::Base.connection.schema_cache.clear!
Property.find_each do |property|
if property.hierarchical?
# Do something interesting
else
# Do something less interesting
end
end
end
def down
# undo some interesting things
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment