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: Define enum mapping methods #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tk0miya
Copy link
Collaborator

@tk0miya tk0miya commented Nov 16, 2024

ActiveRecord generates enum mapping methods for each enum definition.

For example, the following enum definition generates .statuses method that returns a mapping from enum key to value.

enum status: [:active, :inactive]

refs:

ActiveRecord generates enum mapping methods for each enum definition.

For example, the following enum definition generates `.statuses` method
that returns a mapping from enum key to value.

```ruby
enum status: [:active, :inactive]
```

refs:

* https://api.rubyonrails.org/classes/ActiveRecord/Enum.html
* https://github.com/rails/rails/blob/v6.0.6.1/activerecord/lib/active_record/enum.rb#L163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant