nifty-utils 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nifty/utils/active_record/random_string.rb +9 -7
- data/lib/nifty/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7861fedc957d1694081a793e3ae68e3098336ed6
|
4
|
+
data.tar.gz: 08fcbd00f993d4af6416692a985e63a2fb70238d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fe3ac954656f74a573d227b550f303b0a01c57b0b39d02678c84e2f8d3598bbcbfc4fdb68abcc6fdcd0375453c3237a9546ad68ce3c00ea2a32783d9edbb4aa
|
7
|
+
data.tar.gz: 981b1c35bd0579fdd43d4e588ac45e9d7e56f6d19ed82c7a088acf2e0d0a43e03e8612a080fb7ddd3954d38c4196658b2c31c1e10e7a8807a4ce03a7298736d9
|
@@ -43,15 +43,17 @@ module Nifty
|
|
43
43
|
|
44
44
|
def generate_random_strings
|
45
45
|
self.class.random_string_fields.each do |field, opts|
|
46
|
-
if
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
self.
|
46
|
+
if self.send(field).blank?
|
47
|
+
if opts[:unique]
|
48
|
+
until self.send(field)
|
49
|
+
proposed_string = RandomString.random_string(opts[:type], opts)
|
50
|
+
unless self.class.where(field => proposed_string).exists?
|
51
|
+
self.send("#{field}=", proposed_string)
|
52
|
+
end
|
51
53
|
end
|
54
|
+
else
|
55
|
+
self.send("#{field}=", RandomString.random_string(opts[:type], opts))
|
52
56
|
end
|
53
|
-
else
|
54
|
-
self.send("#{field}=", RandomString.random_string(opts[:type], opts))
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
data/lib/nifty/utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nifty-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A set of useful utilties for Rails applications.
|
14
14
|
email:
|