views:

9

answers:

1

Here's my model:

class Comment < ActiveRecord::Base
  serialize :request_headers
end

But when I try to do @comment.request_headers = request.headers I get a TypeError (can't dump anonymous class Class) exception.

Another way to ask my question: how can I convert request.headers into a Hash? It uses a Hash under the covers so this should be easy, no?

A: 

Its probably the memoization in header.rb

Since it supports a to_a so you can simply convert it to an array before serializing.

@comment.request_headers = request.headers.to_a
Sam Saffron