ActionView::TemplateError "changes was supposed to be a Hash, but was a String" #52

Open
csommerauer opened this Issue Oct 12, 2010 · 1 comment

Comments

Projects
None yet
1 participant

This seems to happen after updating a timestamp. Below is the code in the template that creates the TemplateError

<% @model.versions.each do |version| %>
<%= version.changes['last_run'][1] %>
<%end%>

Database entry for "changes" causing the error
--- last_run: - !timestamp 20.10.2010 - !timestamp 14.10.2010

when escaping the the exclamation mark with a forward slash in the DB the error disappears.

The real error is actually
ActiveRecord::SerializationTypeMismatch
which pointed me in the right direction to solve this problem

This is actually a Rails Date.to_yaml issue if
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS[:default]
is set to a Date format that YAML doesn't like. There is a workaround that worked for me at
https://rails.lighthouseapp.com/projects/8994/tickets/340-yaml-activerecord-serialize-and-date-formats-problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment