trax_model 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trax/model/unique_id.rb +13 -5
- data/lib/trax_model/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a86c5949b3cd7f7ac7767f1dbf1a5b19dbc34d5
|
4
|
+
data.tar.gz: 98c3b79365a9481776921ccda2fa84de42e79627
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98dad576741bcaad00821fe586117bf9259ca23c39c198e06d9a2ecf86b523a48d5dbe9a904257947dd9e4207451205d658acbe745cdf4b7c3e68279c640a2ae
|
7
|
+
data.tar.gz: 6f9ead4ee3ce3e17909e53d88c560542300cf65896c265bb58f9e3112b0e0fc3a7014406eb88c039bd000995e2c050167f3b7da283f0c8bfa04003efdee536c8
|
data/lib/trax/model/unique_id.rb
CHANGED
@@ -12,19 +12,27 @@ module Trax
|
|
12
12
|
}.freeze
|
13
13
|
|
14
14
|
def uuid
|
15
|
-
|
15
|
+
uuid_column = self.class.trax_defaults.uuid_column
|
16
|
+
uuid_value = (uuid_column == :uuid) ? super : __send__(uuid_column)
|
17
|
+
|
18
|
+
::Trax::Model::UUID.new(uuid_value)
|
16
19
|
end
|
17
20
|
|
18
|
-
#i.e
|
21
|
+
#i.e. Blog::Post
|
19
22
|
def uuid_type
|
20
|
-
uuid.record_type
|
23
|
+
uuid.record_type
|
21
24
|
end
|
22
25
|
|
23
|
-
#i.e. Blog::Post
|
24
|
-
def
|
26
|
+
#i.e. 'Blog::Post'
|
27
|
+
def uuid_type_name
|
25
28
|
uuid.record_type.name
|
26
29
|
end
|
27
30
|
|
31
|
+
#i.e, Blog::Post will = post
|
32
|
+
def uuid_type_slug
|
33
|
+
uuid.record_type.name.demodulize.underscore
|
34
|
+
end
|
35
|
+
|
28
36
|
module ClassMethods
|
29
37
|
delegate :uuid_prefix, :to => :trax_defaults
|
30
38
|
delegate :uuid_column, :to => :trax_defaults
|
data/lib/trax_model/version.rb
CHANGED