// refactoring from https://github.com/leonid-shevtsov/cacheable-flash-jquery
var Flash = new Object();

Flash.data = {};

Flash.transferFromCookies = function() {
  var data = JSON.parse(unescape($.cookie("flash") || '{}'));
  if(!data) data = {};
  Flash.data = data;
  $.cookie('flash', null, {path: '/', domain: '<%=CacheableFlash::Config.config[:domain]%>'});
};

Flash.writeDataTo = function(name, element, callback) {
  element = $(element);
  var message = "";
  if (Flash.data[name]) {
    message = Flash.data[name].toString().replace(/\+/g, ' ');
    element.text(message);
    if (callback && typeof(callback) === 'function') {
      callback(element);
    } else {
      element.show();
    }
  }
};

// refactoring from https://github.com/leonid-shevtsov/cacheable-flash-jquery
var Flash = new Object();

Flash.data = {};

Flash.transferFromCookies = function() {
  var data = JSON.parse(unescape($.cookie("flash") || '{}'));
  if(!data) data = {};
  Flash.data = data;
  $.cookie('flash', null, {path: '/', domain: '<%=CacheableFlash::Config.config[:domain]%>'});
};

Flash.writeDataTo = function(name, element, callback) {
  element = $(element);
  var message = "";
  if (Flash.data[name]) {
    message = Flash.data[name].toString().replace(/\+/g, ' ');
    element.html(message);
    if (callback && typeof(callback) === 'function') {
      callback(element);
    } else {
      element.show();
    }
  }
};

Insert content as HTML and not plain text
Insert content as HTML and not plain text

This was the cause of html_safe strings still showing html content.