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.
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.
Ouch! The
#try!thing in Rails 4 reeks of PHP’smysql_unescape_realthough.try_but_not_too_hardThis is especially frustrating because they changed the behavior of
#tryin 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,
#trysays:http://api.rubyonrails.org/v3.2.22/classes/Object.html#method-i-try
But in Rails 4.0.0 it says:
http://api.rubyonrails.org/v4.0.0/classes/Object.html#method-i-try