Returning a blank response in Ruby on Rails is trickier than we first imagined. For instance, we thought that either one of these two methods would suffice:
render text: nil
render nothing: true
But they don’t. Both of these methods result in a response with a Content-Length value of 1. What’s the content? A single hex character of 20, which represents a single whitespace character.
We played around with a few other options and found that this is the most straightforward method to provide a truly blank response:
render text: ''