Module: Uuidify
- Defined in:
- lib/uuidify.rb,
lib/uuidify/engine.rb,
lib/uuidify/version.rb
Defined Under Namespace
Modules: UuidifyConcern Classes: Engine, Uuid, UuidifyException
Constant Summary collapse
- VERSION =
"0.5.0"
Class Method Summary collapse
-
.garbage_collect_uuids ⇒ Object
Clean up all orphaned and useless UUIDs in the database, whether or not we can resolve them to a class.
Class Method Details
.garbage_collect_uuids ⇒ Object
Clean up all orphaned and useless UUIDs in the database, whether or not we can resolve them to a class.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/uuidify.rb', line 12 def self.garbage_collect_uuids Uuidify::Uuid.select("model_name").group("model_name").each do |m| begin klass = m.model_name.constantize klass.garbage_collect_uuids rescue NameError => ex # Class that doesn't exist in current project Uuidify::Uuid.where(:model_name => m.model_name).delete_all end end end |