custom_fields 1.0.0.beta.5 → 1.0.0.beta.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,6 +51,11 @@ module CustomFields
51
51
  else
52
52
  apply_default_type(klass)
53
53
  end
54
+
55
+ # add validation if required field
56
+ if self.required?
57
+ klass.validates_presence_of self.safe_alias.to_sym
58
+ end
54
59
  end
55
60
 
56
61
  def safe_alias
@@ -18,7 +18,7 @@ module CustomFields
18
18
  end
19
19
 
20
20
  def #{self.safe_alias}=(value)
21
- if value.is_a?(::String)
21
+ if value.is_a?(::String) && !value.blank?
22
22
  date = ::Date._strptime(value, I18n.t('date.formats.default'))
23
23
  value = ::Date.new(date[:year], date[:mon], date[:mday])
24
24
  end
@@ -14,11 +14,6 @@ module CustomFields
14
14
  alias :#{self.safe_alias} :#{self._name}
15
15
  alias :#{self.safe_alias}= :#{self._name}=
16
16
  EOF
17
-
18
- # add validation if required field
19
- if self.required?
20
- klass.validates_presence_of self.safe_alias.to_sym
21
- end
22
17
  end
23
18
 
24
19
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module CustomFields
3
- VERSION = "1.0.0.beta.5"
3
+ VERSION = "1.0.0.beta.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: custom_fields
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196361
4
+ hash: 62196367
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
10
  - beta
11
- - 5
12
- version: 1.0.0.beta.5
11
+ - 6
12
+ version: 1.0.0.beta.6
13
13
  platform: ruby
14
14
  authors:
15
15
  - Didier Lafforgue
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-03-06 00:00:00 +01:00
20
+ date: 2011-03-08 00:00:00 +01:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency