Module: HasUuid
- Defined in:
- lib/has_uuid.rb,
lib/has_uuid/railtie.rb,
lib/has_uuid/version.rb,
lib/has_uuid/active_record/reflection.rb,
lib/has_uuid/active_record/finder_methods.rb,
lib/has_uuid/active_record/belongs_to_association.rb,
lib/has_uuid/active_record/connection_adapters/migration.rb,
lib/has_uuid/active_record/associations/singular_association.rb,
lib/has_uuid/active_record/associations/collection_association.rb,
lib/has_uuid/active_record/associations/builder/singular_association.rb,
lib/has_uuid/active_record/associations/builder/collection_association.rb
Defined Under Namespace
Modules: ActiveRecord, Mixin Classes: Railtie
Constant Summary collapse
- VERSION =
"0.3.0"
- VALID_FORMAT =
/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})$/
Class Method Summary collapse
Class Method Details
.check_uuid(klass) ⇒ Object
54 55 56 57 58 |
# File 'lib/has_uuid.rb', line 54 def self.check_uuid(klass) return false if klass.uuid && klass.id && klass.class.where("#{klass.class.primary_uuid} = ?", klass.uuid).where('id <> ?', klass.id).count > 0 return false if klass.uuid && klass.new_record? && klass.class.where("#{klass.class.primary_uuid} = ?", klass.uuid).count > 0 return true end |