Make defined enums inheritable

Fixes https://github.com/rails/rails/issues/14607