mirror of https://github.com/rails/rails
Utilize new enum syntax
Utilize the new `enum` syntax in this guide to avoid confusion with the old one.
This commit is contained in:
parent
581074c40d
commit
7904681f77
|
@ -292,9 +292,9 @@ Declaring an enum attribute in the model adds helper methods and prevents invali
|
|||
```ruby
|
||||
# app/models/article.rb
|
||||
class Article < ApplicationRecord
|
||||
enum status: {
|
||||
enum :status, {
|
||||
draft: "draft", published: "published", archived: "archived"
|
||||
}, _prefix: true
|
||||
}, prefix: true
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue