Storing & retrieving a serialized hash in the DB is not working

Hey all,

I am trying to find a way to store an hash of variable size (could be
3 pairs, could by 8 pairs) in a text field in the database. I have
the following [simplified] setup:


serialize :content


[all the normal create, edit, etc. stuf]


<% form_for @grading_scale do |f| %>
<%= f.text_field ‘content[1][letter]’ %>
<%= f.text_field ‘content[1][grade]’ %>
<%= f.text_field ‘content[2][letter]’ %>
<%= f.text_field ‘content[2][grade]’ %>

<% end %>

This actually stores the correct data in the database and it even
shows up in the view when I show <%= debug @scale %>. However, no
matter how hard I try I cannot get it to display the data from the
database in the text fields. I can change/add new data without
problems but I can’t show the user the data. What am I doing wrong?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs