Rails 7 adds invert_where method to ActiveRecord | Saeloun Blog
22-Apr-2021 1149
We often come across cases in our Rails application where we want to negate our where clause conditions.Let’s say we have a system that requires users to verify both their email and phone number. We add two columns email_verified and phone_verified to our User model for verifying the account.A user is verified only if both the email and phone of the user are verified by the system.BeforeBefore Rails 7, we would add verified and unverified scopes to our User model to get the details of verified and unverified users in our system.
Rails 7 adds invert_where method to ActiveRecord | Saeloun Blog #ruby #rubydeveloper #rubyonrails #Rails #invert_where #method #ActiveRecord #Saeloun #activerecord #blog https://rubyonrails.ba/link/rails-7-adds-invert_where-method-to-activerecord-saeloun-blog