Fix JRuby and Rubinius. Fix ActiveRecord 3.x support.