RNHurt
2009-Apr-29 19:18 UTC
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: # model serialize :content # controller [all the normal create, edit, etc. stuf] # view <% 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? Thanx! Richard