diff options
author | Zac <xanhast@gmail.com> | 2014-05-09 21:46:22 +0100 |
---|---|---|
committer | Zac <xanhast@gmail.com> | 2014-05-09 21:46:22 +0100 |
commit | 21b0c2e8a7119fd667e02f4207f0eaa3bd33d3bc (patch) | |
tree | b22c3979302e60b650ca6f919f0707359505d74c /activerecord | |
parent | f4511690994f0c14c60320bbeecc66549332dbee (diff) | |
download | rails-21b0c2e8a7119fd667e02f4207f0eaa3bd33d3bc.tar.gz rails-21b0c2e8a7119fd667e02f4207f0eaa3bd33d3bc.tar.bz2 rails-21b0c2e8a7119fd667e02f4207f0eaa3bd33d3bc.zip |
Documentation, add examples of using an Enum scope
When scanning the Enum API page I found it easy to miss that scopes are generated. Adding an example clarifies use and has more... *pop*...
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/enum.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index 18f1ca26de..c7ec093824 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -27,8 +27,10 @@ module ActiveRecord # 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. + # as well. With the above example: + # + # Conversation.active + # Conversation.archived # # You can set the default value from the database declaration, like: # |