Convention over configuration
Posted by MSch Sat, 17 Dec 2005 12:31:00 GMT
Lucas Carlson tried to fix ERB’s html_escape to escape special characters, because he didn’t like that Rails produced instead of with this statement:button_to '< Back', :action => 'view', :id => 3I was a fool. Not only did I completely ignore the potential security breach (XSS) that was introduced by essentially removing html_escape’s teeth, but I also neglected to see the really Rails like solution.
Rails is based on many principles that sound like buzzwords, but in fact aren’t. Convention over configuration is one of them, and it means that there’s always one favoured way to do something. And for his problem this way is replacing the < with a plain old <:button_to '< Back', :action => 'view', :id => 3