ActiveSupport

Rails 2.3 : Object#try

you can avoid nil-checking @person.try(:name) # @person ? @person.name : nil @people.try(:collect) {|p| p.name} Person.try(:find, 1) Product.find_by_price(4.95).try(:name) Ruby on Rails 2.3 Release Notes - 7.1 Object#try Class: Object Rail…

rescue_from

Rescue exceptions raised in controller actions. class ApplicationController < ActionController::Base rescue_from ActionController::RoutingError, :with => :route_not_found private def route_not_found(exception) render :text => exception.mes…

Rails 2.2 : Memoization

Memoization is a pattern of initializing a method once and then stashing its value away for repeat use. extend ActiveSupport::Memoizable def full_name "#{first_name} #{last_name}" end memoize :full_name Ruby on Rails 2.2 Release Notes - 9.…