mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Updated comment to mention the enum mapping class method [ci skip]
This commit is contained in:
parent
ce95fb2991
commit
e64a83cdbd
1 changed files with 3 additions and 2 deletions
|
@ -54,11 +54,12 @@ module ActiveRecord
|
|||
# remove unused values, the explicit +Hash+ syntax should be used.
|
||||
#
|
||||
# In rare circumstances you might need to access the mapping directly.
|
||||
# The mappings are exposed through a constant with the attributes name:
|
||||
# The mappings are exposed through a class method with the pluralized attribute
|
||||
# name:
|
||||
#
|
||||
# Conversation.statuses # => { "active" => 0, "archived" => 1 }
|
||||
#
|
||||
# Use that constant when you need to know the ordinal value of an enum:
|
||||
# Use that class method when you need to know the ordinal value of an enum:
|
||||
#
|
||||
# Conversation.where("status <> ?", Conversation.statuses[:archived])
|
||||
module Enum
|
||||
|
|
Loading…
Reference in a new issue