Issues with globalize code from Rails Recipes

I’m looking into using globalize for our corp intranet. I’m following
the instructions from the Rails Recipes book. One issue I have come
across involves the following snippet of code:

class ApplicationController < ActionController::Base

after_filter :set_charset

def set_charset
unless @headers[“Content-Type”] =~ /charset/i
@headers[“Content-Type”] ||= “”
@headers[“Content-Type”] += “; charset=utf-8”
end
end
end

this is directly from the book. what i am noticing is that the response
headers are coming back to the browser as:

Content-Type: ;charset=utf-8

notice there is no actual content-type. if i force it to text/html

@headers[“Content-Type”] ||= “text/html”

i then see that the content-type is now set correctly and rjs appears to
still work so I am wondering if this is a typo in the code from the book
or is it something more.

Chris

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