Repository navigation
Add negative scopes for all enum values - #35381
Conversation
|
|
||
| Example: | ||
|
|
||
| class Post < ActiveRecord::Base |
There was a problem hiding this comment.
@dhh: I think you need to add extra 2 spaces here. The example structure is broken here https://github.com/rails/rails/blob/negative-enum-scope/activerecord/CHANGELOG.md
There was a problem hiding this comment.
Also, I don't know if it matters or not, but we should inherit class Post from ApplicationRecord instead here
There was a problem hiding this comment.
I'll do the indent, but ApplicationRecord is really a Rails concern, not an Active Record concern. Maybe a fine point of difference, but it's there.
|
@dhh : I think we should also add |
|
Not needed. You can always negate a predicate method in a variety of ways with |
Add negative scopes for all enum values rails/rails#35381
Particularly convenient when you want to disallow access in a controller, like
Post.not_trashed.find(params[:id]).