smarter_dates 0.2.7.12 → 0.2.7.13

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.
@@ -44,11 +44,13 @@ def self.included( klass ) # :nodoc:
44
44
  rescue
45
45
  dt = val
46
46
  end
47
- if defined?(Rails) && dt
48
- if k.match(/_(?:on|d)$/)
47
+ if defined?(Rails)
48
+ if dt && k.match(/_(?:on|d)$/)
49
49
  self[k] = dt.to_date
50
- else
50
+ elsif dt
51
51
  self[k] = dt.to_datetime
52
+ else
53
+ self[k] = dt
52
54
  end
53
55
  else
54
56
  instance_variable_set(:"@#{k}",dt)
@@ -1,4 +1,4 @@
1
1
  module SmarterDates
2
- VERSION = '0.2.7.12'
2
+ VERSION = '0.2.7.13'
3
3
  end
4
4
 
@@ -56,6 +56,9 @@ class SmarterDatesTest < Test::Unit::TestCase
56
56
  @model.birth_d = "32 April 1976"
57
57
  assert_equal nil, @model.birth_d
58
58
 
59
+ @model.birth_d = nil
60
+ assert_equal nil, @model.birth_d
61
+
59
62
  # TODO: fix this in chronic
60
63
  if false
61
64
  @model.birth_d = "30 Feb 1976"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: smarter_dates
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.7.12
5
+ version: 0.2.7.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paul Belt