Add methods to work around rails bug (https://github.com/rails/rails/issues/9517)