lib/tuning/extensions/action_view/handlers.rb in tuning-5.1.0 vs lib/tuning/extensions/action_view/handlers.rb in tuning-5.1.2

- old
+ new

@@ -6,15 +6,23 @@ class Ruby def call(template) if template.type.json? - <<-STRING - output = begin - #{template.source} - end - output.to_json - STRING + if File.basename(template.identifier).starts_with?('_') + template.source + else + <<~STRING + output = begin + #{template.source} + end + if output.is_a?(String) + output + else + output.to_json + end + STRING + end else template.source end end