aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/enum.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/enum.rb')
-rw-r--r--activerecord/lib/active_record/enum.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb
index 3086f13f96..5cb80d185b 100644
--- a/activerecord/lib/active_record/enum.rb
+++ b/activerecord/lib/active_record/enum.rb
@@ -32,6 +32,12 @@ module ActiveRecord
# Conversation.active
# Conversation.archived
#
+ # Of course, you can also query them directly if the scopes doesn't fit your
+ # needs:
+ #
+ # Conversation.where(status: [:active, :archived])
+ # Conversation.where("status <> ?", :active)
+ #
# You can set the default value from the database declaration, like:
#
# create_table :conversations do |t|
@@ -63,11 +69,6 @@ module ActiveRecord
#
# Conversation.statuses # => { "active" => 0, "archived" => 1 }
#
- # Use that class method when you need to know the ordinal value of an enum:
- #
- # Conversation.where("status <> ?", Conversation.statuses[:archived])
- #
- # Where conditions on an enum attribute must use the ordinal value of an enum.
module Enum
def self.extended(base) # :nodoc:
base.class_attribute(:defined_enums)