Fix #2248, convert ActiveSupport::SafeBuffer to string using #to_str