fix deprecation warnings for ActiveRecord 4