Monthly Archives: February 2014

In Rails, html_safe is an adjective, not a verb

Note that in Rails, string.html_safe means that string is known to be safe html, and should not be escaped; otherwise, all strings are escaped by default (for output). It does not mean that string should be escaped to become safe!

Comparing strings to potentially null values in Rails

I’m fairly new to Rails, and Ruby, for that matter, and not yet sure of some basic things. I’ve read a bunch about how to test for (and not test for) nil or empty, and also about how to avoid that need – for instance, see this very useful post on keenertech.com. But, I can’t seem […]