Migrate to the new ActiveRecord API