update for ruby 2.0 and activerecord 3.2