Fix ActiveRecord method deprecation issues