Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a warning for enum elements with 'not_' prefix. #36380

Merged

Conversation

edudepetris
Copy link
Contributor

@edudepetris edudepetris commented Jun 2, 2019

Summary

Addresses #36272

I added a new warning when an user creates enum elements with not_ prefix

Example

class Foo < ActiveRecord::Base
  enum status: [:sent, :not_sent]
end
$ bin/rails c 
Loading development environment (Rails 6.1.0.alpha)
 :001 > Foo
An enum element in Foo uses the prefix 'not_'. This will cause a conflict with auto generated negative scopes.

The enum element not_sent trigger the new warning

Other Information

CHANGELOG updated.

@edudepetris edudepetris force-pushed the ed/36272-better-negative-scope-warning branch 2 times, most recently from f6c4616 to 96e3bab Compare June 14, 2019 23:31
When a enum element contains the prefix 'not_'. I warns to users
to be aware of this new feature.

Example code:
    class Foo < ActiveRecord::Base
      enum status: [:sent, :not_sent]
    end
@edudepetris edudepetris force-pushed the ed/36272-better-negative-scope-warning branch from 96e3bab to 77daacf Compare June 30, 2019 18:22
rafaelfranca added a commit that referenced this pull request Jul 25, 2019
…cope-warning

Add a warning for enum elements with 'not_' prefix.
@rafaelfranca rafaelfranca merged commit 77daacf into rails:master Jul 25, 2019
rafaelfranca added a commit that referenced this pull request Jul 25, 2019
…cope-warning

Add a warning for enum elements with 'not_' prefix.
suketa added a commit to suketa/rails_sandbox that referenced this pull request Feb 14, 2020
Add a warning for enum elements with 'not_' prefix.
rails/rails#36380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants