Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum with strings #43529

Merged
merged 1 commit into from Oct 25, 2021
Merged

Enum with strings #43529

merged 1 commit into from Oct 25, 2021

Conversation

elfassy
Copy link
Contributor

@elfassy elfassy commented Oct 25, 2021

Summary

There already seems to be support for using strings instead of integers with enums, see https://github.com/rails/rails/blob/5cdd4e5aba93e614ea286c10b7dbcc0a468497e7/activerecord/test/models/book.rb#L18 but nothing is using this in the tests.

This PR adds more tests and updates the description to make this usage explicit.

Other Information

this PR was also attempted here in 2017 and here in 2019. Comments from DHH about explaining that using non-integers is less performant have been addressed in this PR

@rafaelfranca rafaelfranca merged commit d4583af into rails:main Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants