create_custom_attributes 0.5.12 → 0.5.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0445ce94c2b0d7cb72b52f3962f73ba59aef43f4
4
- data.tar.gz: a3e22072e9f332e88219ed67f2b4a08f106d6202
3
+ metadata.gz: a4e1862aafca980f83225e010364373aa641fce9
4
+ data.tar.gz: 2096355a6e300b4421bb5ee34a924506eb48308c
5
5
  SHA512:
6
- metadata.gz: fe1d4d5d02a055d40c58e5c5ff802362a1c2acb791216c0887212960c71fbcf719ed0728f3b10149f6eb48832689f1f3157e0dd89fae5aeab7d203dde943b6af
7
- data.tar.gz: 2c37132a2f9a37a0ca55cb540d28725b66b0ebbb4ff4dea5883bbb05079fe3681e073d3a3e8d130bdf8b7206c86b59f4a7fe803d8eeee171aa7e8f59f223a068
6
+ metadata.gz: e53b16397eb4b23c4e56fe8394b27bcfb910a434b9331e1801039fbb9620b195a7b348d967361b0129666dd5ce3fb33ac91677837650864be662939b8e533ed8
7
+ data.tar.gz: e96195f92dd50114ce8446c9ca815340f2003b02e4fce65be3d998509243efb943add37dba5004d6d360b31fb06c9878c09627e9cba7e00309d4fca34ac199c5
@@ -25,9 +25,12 @@ module CustomAttributes
25
25
  end
26
26
 
27
27
  def value
28
- return read_attribute(:value) if new_record?
28
+ field_value = read_attribute(:value) || nil
29
29
 
30
- read_attribute(:value) || custom_field.try(:default)
30
+ field_value = nil if field_value.nil? || ( !field_value.is_a?(Numeric) && field_value.empty? )
31
+ return field_value if new_record?
32
+
33
+ field_value || custom_field.try(:default)
31
34
  end
32
35
 
33
36
  def true?
@@ -1,3 +1,3 @@
1
1
  module CustomAttributes
2
- VERSION = '0.5.12'.freeze
2
+ VERSION = '0.5.13'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: create_custom_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Grützmacher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2018-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails