Adding support to :cast_as => 'Date'.
This commit is contained in:
parent
273a174aae
commit
bc6df2f5ca
3 changed files with 10 additions and 1 deletions
|
@ -53,6 +53,9 @@ module CouchRest
|
|||
# Auto parse Time objects
|
||||
self[property.name] = if ((property.init_method == 'new') && target == 'Time')
|
||||
self[key].is_a?(String) ? Time.parse(self[key].dup) : self[key]
|
||||
elsif
|
||||
((property.init_method == 'new') && target == 'Date')
|
||||
self[key].is_a?(String) ? Date.parse(self[key].dup) : self[key]
|
||||
else
|
||||
# Let people use :send as a Time parse arg
|
||||
klass = ::CouchRest.constantize(target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue