I know Rails 2.3 is out and has a new "try" method, But I was looking into an old app and I saw some code I have written. It's extending the object class with a method called tot (that or that lolol) so that you can use it anywhere like in the example:
tot do params[:search][:name] end
or like that
tot(:also => ["","nome feio"], return => "nome invalido") do params[:search][:name] end
this last example case will return "nome invalido" in case of params[:search][:name] being empty string, "nome feio", or if a NoMethodError happens", other wise it will return params[:search][:name] value And that is my code extending object class.
class Object
  def tot(options = {})
      (options[:also] and options[:also].include?(yield)) ? options[:return] : yield
      rescue NoMethodError
I found it funny, anyway Ruby on Rails got it's own try method built in some months later.