Store request.headers in a serialized model attribute

Posted by Horace Loeb on Stack Overflow See other posts from Stack Overflow or by Horace Loeb
Published on 2010-06-06T22:05:06Z Indexed on 2010/06/06 22:12 UTC
Read the original article Hit count: 201

Filed under:

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?

© Stack Overflow or respective owner

Related posts about ruby-on-rails