diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2015-02-14 00:04:16 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2015-02-14 00:04:16 -0800 |
commit | 698afe1173c6501d29b98389204d3ac70aaea910 (patch) | |
tree | 739c202bbd2f595a43fb6d7c3711f258f71d5dfd /activerecord/lib | |
parent | e076d7290d523759900ee1ba3c9843c7f324adc7 (diff) | |
download | rails-698afe1173c6501d29b98389204d3ac70aaea910.tar.gz rails-698afe1173c6501d29b98389204d3ac70aaea910.tar.bz2 rails-698afe1173c6501d29b98389204d3ac70aaea910.zip |
Mention `where.not` in the example
...so it doesn't look like you *have* to use SQL strings for that case (not
anymore!). Would like to replace the SQL string example with something that
you cannot do with the "normal" query API, but I could not come up with a
short, realistic example. Suggestions welcome!
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/enum.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index 1afbfb1977..470e0b5d29 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -36,6 +36,7 @@ module ActiveRecord # needs: # # Conversation.where(status: [:active, :archived]) + # Conversation.where.not(status: :active) # # You can set the default value from the database declaration, like: # @@ -69,9 +70,8 @@ module ActiveRecord # Conversation.statuses[:active] # => 0 # Conversation.statuses["archived"] # => 1 # - # Use that class method when you need to know the ordinal value of an enum. For - # example, you can use that when manually building a SQL string inside a `where` - # condition: + # Use that class method when you need to know the ordinal value of an enum. + # For example, you can use that when manually building SQL strings: # # Conversation.where("status <> ?", Conversation.statuses[:archived]) # |