headers['Content-Type'] & link_to_remote on Rails Edge

I’m on rails edge and am calling an after filter on my actions. Works
except for my ajax calls via link_to_remote. When I inspect headers,
I see the ‘Content-Type’ is key for an object rather than a string.
Shouldn’t it be a string? Anyone know if this is a bug or if I’m
dealing with this incorrectly.

Thanks,

Jamie

The code:
after_filter :set_charset
def set_charset
logger.debug("!!!---- headers: #{headers.inspect}")
unless headers[‘Content-Type’] =~ /charset/i
headers[‘Content-Type’] ||= “text/html”
headers[‘Content-Type’] += ‘; charset=utf-8’
end
headers[‘Pragma’] = ‘no-cache’
headers[‘Cache-Control’] = ‘no-cache, no-store, must-revalidate’
end

from the logger:
!!!---- headers: {“Status”=>“200 OK”, “cookie”=>[],
“Content-Type”=>#<Mime::Type:0x1316954
@synonyms=[“application/javascript”, “application/x-javascript”],
@symbol=:js, @string=“text/javascript”>,
“Cache-Control”=>“no-cache”}

Part of the stack trace:

NoMethodError (undefined method +' for #<Mime::Type:0x1316954>): /app/controllers/application.rb:87:inset_charset’
.//vendor/rails/actionpack/lib/action_controller/filters.rb:
471:in call' .//vendor/rails/actionpack/lib/action_controller/filters.rb: 465:incall’
.//vendor/rails/actionpack/lib/action_controller/filters.rb:
633:in call_filter' .//vendor/rails/actionpack/lib/action_controller/filters.rb: 615:inperform_action_without_benchmark’
.//vendor/rails/actionpack/lib/action_controller/benchmarking.rb:
66:in `perform_action_without_rescue’

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