Rails 6 adds negative scopes on enum

07-Mar-2019 1761
This blog is part of our Rails 6 series. Rails 6.0.0.beta2 was recently released.When an enum attribute is defined on a model, Rails adds some default scopes to filter records based on values of enum on enum field.Here is how enum scope can be used.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle