การใช้ภาษาไทยร่วมกับ RJS

เพิ่ม code ด้านล่างนี้ไว้ใน controllers/application.rb

after_filter :set_charset
 
def set_charset
  content_type = @headers["Content-Type"] || 'text/html'
  if /^text\//.match(content_type)
    @headers["Content-Type"] = "#{content_type}; charset=utf-8"
  end
end