Ouch! The #try! thing in Rails 4 reeks of PHP’s mysql_unescape_real though.
This is especially frustrating because they changed the behavior of #try in Rails 4.0 and added #try! with the old behavior.
I thought #try was the same, but they added #try! which would basically do what Avdi was implying #try should already be doing?
In Rails 3.2.22, #try says:
Invokes the method identified by the symbol method … just like the regular Ruby Object#send does. Unlike that method however, a NoMethodError exception will not be raised and nil will be returned instead, if the receiving object is a nil object or NilClass.
But in Rails 4.0.0 it says:
Invokes the public method whose name goes as first argument just like public_send does, except that if the receiver does not respond to it the call returns nil rather than raising an exception.