Having problems with serialize :column_name

Hi guys

I have asked this questions on the Rails Forum as well, but haven't
got any reply, so I will try here.

The thing is this:

I want to store "portlets" in a Portlet model in the db. I want to
store them togheter as they are the same kind of data in a way, but
there are different variateions of a portlet. They only have one db
column in common, the rest can vary a lot. So to do this I would like
to store the rest of the data in one single column.

What I have done to do this is the following:

1. The model Portlet contains the columns id, name, portlettype_id &
hash_value. The value in portlettype_id will decide what has to be
stored in the hash_value column. Reading from the docs, I have also
put "serialize :hash_value" in the class code.

2. So in my new action in my PortletsController I just do @portlet =

3. In my new.html.erb I have done the following (I'm leaving out some
formatting specific html in this example):
<% form_for @project do |f| %>
    <%= f.text_field :name %>
    <%= f.collection_select :portlettype_id, ......... %>
    <% fields_for "portlet[hash_value] do |hf| %>
        <%= hf.text_field :heading %>
        <%= hf.text_area :body %>
    <% end %>
<% end %>

4. Everything renders nice and I do get inputs with name
portlet[hash_value][heading] etc.

5. When I submit, the development log shows "hash_value" =>
{ "heading" => "text"} in the params hash, so it does seem to me that
I do get the hash_value containing a hash itself.

6. When I save, the name and portlettype_id fields get saved
correctly, but in the hash_value column i get !

It seems to me that I must be doing something wrong, because when I
read about serialize in the api docs, it sounds like it would do
exactly what I'm after.

Any ideas? I would be glad to supply you with more info, as I badly
want to solve this problem.