uuidable 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/uuidable/active_record.rb +7 -2
- data/lib/uuidable/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7243fffe7adb312c2dbf701e37b459c4e5d3cd12
|
|
4
|
+
data.tar.gz: 9925352679e6fba0c5a6df14497f72d47170a939
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28fe8675eee77c1d8b6ae4ca32603fe0a020533e0f3bf5cac68bf72e5b8a3e1d0447be37331d3d7d8569081e9c30e1d704417d2ef3b5ed698ce59d1c12087c81
|
|
7
|
+
data.tar.gz: 594ab432715ebbe4a4a9872550c967a4f476e3d0682eb11813ad835ab902b7f13aa12a52f9494b56213b1da49e49173f5e83eb0f4517955109f332c0a5ec56ae
|
data/.rubocop.yml
CHANGED
|
@@ -5,8 +5,7 @@ module Uuidable
|
|
|
5
5
|
|
|
6
6
|
class UuidChangeError < RuntimeError; end
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
module ClassMethods
|
|
8
|
+
module Finder
|
|
10
9
|
def find(*args)
|
|
11
10
|
if args.first && args.first.is_a?(String) && args.first.match(UUIDTools::UUID_REGEXP)
|
|
12
11
|
find_by_uuid!(*args)
|
|
@@ -14,6 +13,11 @@ module Uuidable
|
|
|
14
13
|
super
|
|
15
14
|
end
|
|
16
15
|
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# ClassMethods
|
|
19
|
+
module ClassMethods
|
|
20
|
+
include Finder
|
|
17
21
|
|
|
18
22
|
def uuidable(as_param: true)
|
|
19
23
|
after_initialize { self.uuid = Uuidable.generate_uuid if attributes.keys.include?('uuid') && uuid.blank? }
|
|
@@ -41,4 +45,5 @@ end
|
|
|
41
45
|
|
|
42
46
|
ActiveSupport.on_load(:active_record) do
|
|
43
47
|
ActiveRecord::Base.send(:include, Uuidable::ActiveRecord)
|
|
48
|
+
ActiveRecord::Relation.send(:prepend, Uuidable::ActiveRecord::Finder)
|
|
44
49
|
end
|
data/lib/uuidable/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uuidable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Gnuskov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-05
|
|
11
|
+
date: 2017-06-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
155
155
|
version: '0'
|
|
156
156
|
requirements: []
|
|
157
157
|
rubyforge_project:
|
|
158
|
-
rubygems_version: 2.
|
|
158
|
+
rubygems_version: 2.6.12
|
|
159
159
|
signing_key:
|
|
160
160
|
specification_version: 4
|
|
161
161
|
summary: Helps using uuid everywhere in routes instead of id for ActiveRecord models.
|