Module: Trax::Model::Mixins::UniqueId

Extended by:
Trax::Model::Mixin
Defined in:
lib/trax/model/mixins/unique_id.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from Trax::Model::Mixin

after_included, extended, mixed, mixed_in

Instance Method Details

#uuidObject



55
56
57
58
59
60
# File 'lib/trax/model/mixins/unique_id.rb', line 55

def uuid
  uuid_column = self.class.unique_id_config.uuid_column
  uuid_value = (uuid_column == "uuid") ? super : __send__(uuid_column)

  ::Trax::Model::UUID.new(uuid_value)
end

#uuid_typeObject

i.e. Blog::Post



63
64
65
# File 'lib/trax/model/mixins/unique_id.rb', line 63

def uuid_type
  uuid.record_type
end

#uuid_type_nameObject

i.e. ‘Blog::Post’



68
69
70
# File 'lib/trax/model/mixins/unique_id.rb', line 68

def uuid_type_name
  uuid.record_type.name
end

#uuid_type_slugObject

i.e, Blog::Post will = post



73
74
75
# File 'lib/trax/model/mixins/unique_id.rb', line 73

def uuid_type_slug
  uuid.record_type.name.demodulize.underscore
end