nifty-utils 1.1.3 → 1.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86a0dec067d1856e587e922d6c0e052b4b9370d0
4
- data.tar.gz: 251f41b6eb5a281a6cbe33262d6b12da55a3ac79
3
+ metadata.gz: 7861fedc957d1694081a793e3ae68e3098336ed6
4
+ data.tar.gz: 08fcbd00f993d4af6416692a985e63a2fb70238d
5
5
  SHA512:
6
- metadata.gz: a3cc493a0d24b90bada2d3e0527c387789594322cabd0d3c5a76ab2aa761a502745a6a5af2a15433aeec157127fa330b8c4e1123bbd901eb1d6573ee6c3db0a3
7
- data.tar.gz: 8c46b3dc6b836bcdb5e745372e6e6332f7427efaf4baca2fbf2bbfb14a29810b30010c0eca2ae36031ee89cfff94edb298e7f6377a45b87a67e9315957cee19e
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 opts[:unique]
47
- until self.send(field)
48
- proposed_string = RandomString.random_string(opts[:type], opts)
49
- unless self.class.where(field => proposed_string).exists?
50
- self.send("#{field}=", proposed_string)
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
@@ -1,5 +1,5 @@
1
1
  module Nifty
2
2
  module Utils
3
- VERSION = '1.1.3'
3
+ VERSION = '1.1.4'
4
4
  end
5
5
  end
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.3
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-08 00:00:00.000000000 Z
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: