From 8492f0ea4b00e3d0d14f30225f14cc3e7d255b48 Mon Sep 17 00:00:00 2001 From: Alexey Mahotkin Date: Thu, 16 Mar 2017 23:01:30 +0100 Subject: [PATCH] Pretty-print JSON in development and testing --- app/helpers/react_on_rails_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/react_on_rails_helper.rb b/app/helpers/react_on_rails_helper.rb index bbd4b38c3..0d394cee7 100644 --- a/app/helpers/react_on_rails_helper.rb +++ b/app/helpers/react_on_rails_helper.rb @@ -223,10 +223,10 @@ def server_render_js(js_expression, options = {}) private def json_safe_and_pretty(something) - if Rails.env.development? - ERB::Util.json_escape(JSON.pretty_generate(something.as_json)) - else + if Rails.env.production? ERB::Util.json_escape(something.to_json) + else + ERB::Util.json_escape(JSON.pretty_generate(something.as_json)) end end