Skip to content

Commit

Permalink
Fix for hash model converting strings to times.
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Youch committed May 11, 2010
1 parent e0f2a98 commit 318be8e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/paragraph_renderer.rb
Expand Up @@ -504,7 +504,7 @@ def page_connection_hash_helper(val) #:nodoc:
def set_page_connection_hash_helper(val) # :nodoc:
if val.is_a?(Hash)
if val[:domain_model_hash]
val[:cls].constantize.find(val[:id])
val[:cls].constantize.find_by_id(val[:id])
elsif val[:hash_model_hash]
val[:cls].constantize.new(val[:attr])
else
Expand Down
2 changes: 1 addition & 1 deletion lib/webiva_validation_extension.rb
Expand Up @@ -60,7 +60,7 @@ def validates_datetime(*attr_names)
from = Time.parse_datetime(configuration.delete(:from))
to = Time.parse_datetime(configuration.delete(:to))
validates_each(attr_names, configuration) do |record, attr_name, value|
before_cast = record.send("#{attr_name}_before_type_cast")
before_cast = record.is_a?(HashModel) ? record.send(attr_name) : record.send("#{attr_name}_before_type_cast")
next if allow_nil and (before_cast.nil? or before_cast == '')
next if before_cast.is_a?(Time)
next if before_cast.is_a?(String) && before_cast =~ /^([0-9]{4}\-[0-9]{2}\-[0-9]{2} [0-9]{1,2}\:[0-9]{2}\:[0-9]{2})$/
Expand Down

0 comments on commit 318be8e

Please sign in to comment.