custom_fields 2.1.0.rc → 2.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -68,8 +68,16 @@ module CustomFields
68
68
 
69
69
  def _set_formatted_date(name, value)
70
70
  if value.is_a?(::String) && !value.blank?
71
- date = ::Date._strptime(value, I18n.t('date.formats.default'))
72
- value = date ? ::Date.new(date[:year], date[:mon], date[:mday]) : nil
71
+ # start by the Date.parse method
72
+ _value = ::Date.parse(value) rescue nil
73
+
74
+ # try now with the format defined in the current locale
75
+ if _value
76
+ value = _value
77
+ else
78
+ date = ::Date._strptime(value, I18n.t('date.formats.default'))
79
+ value = date ? ::Date.new(date[:year], date[:mon], date[:mday]) : nil
80
+ end
73
81
  end
74
82
 
75
83
  self.send(:"#{name}=", value)
@@ -124,7 +124,7 @@ module CustomFields
124
124
  [option['_id'], option['name']].include?(id_or_name)
125
125
  end
126
126
 
127
- instance.send(:"#{name}_id=", option['_id'])
127
+ instance.send(:"#{name}_id=", option.try(:[], '_id'))
128
128
  end
129
129
 
130
130
  # Returns a list of documents groupes by select values defined in the custom fields recipe
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module CustomFields #:nodoc
3
3
 
4
- VERSION = '2.1.0.rc'
4
+ VERSION = '2.1.0.rc1'
5
5
 
6
6
  end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: custom_fields
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 2.1.0.rc
5
+ version: 2.1.0.rc1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Didier Lafforgue
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-16 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime
@@ -258,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
258
  - !ruby/object:Gem::Version
259
259
  segments:
260
260
  - 0
261
- hash: -612963602801593079
261
+ hash: 1276482835020364284
262
262
  version: '0'
263
263
  required_rubygems_version: !ruby/object:Gem::Requirement
264
264
  none: false