Skip to content

Instantly share code, notes, and snippets.

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