Rails Model find Where Not | Query where not

Viewed 4435

I have a user model with optional twitter integration.

I've added a 'username' attribute that is only filled when a user has completed twitter authentication.

I want to find all users with the integration. What is the best way to find all objects where an attribute is something, or where it is not nil?

3 Answers

You can execute simple where not query like below

Modal.where.not(name: "abc")
Related