aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/enum.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb
index aebb061717..c042a2f232 100644
--- a/activerecord/lib/active_record/enum.rb
+++ b/activerecord/lib/active_record/enum.rb
@@ -1,5 +1,6 @@
module ActiveRecord
- # Declare an enum attribute where the values map to integers in the database, but can be queried by name. Example:
+ # Declare an enum attribute where the values map to integers in the database,
+ # but can be queried by name. Example:
#
# class Conversation < ActiveRecord::Base
# enum status: [ :active, :archived ]
@@ -23,6 +24,10 @@ module ActiveRecord
# conversation.status.nil? # => true
# conversation.status # => nil
#
+ # Scopes based on the allowed values of the enum field will be provided
+ # as well. With the above example, it will create an +active+ and +archived+
+ # scope.
+ #
# You can set the default value from the database declaration, like:
#
# create_table :conversations do |t|