Reputation: 25348
I want to scope all the records where cancelled_at
IS NULL or empty/blank.
I've found lots of posts asking for IS NOT NULL/empty/blank...but I need the opposite.
I'm sure it's painfully simple, but I'm stumped.
Here's what I've currently got:
scope :active, where("cancelled_at IS NULL")
Upvotes: 2
Views: 3464
Reputation: 54882
Have you tried that?
Patient.where("created_at IS NULL or CAST(created_at as text) = ''")
# SELECT "patients".* FROM "patients" WHERE (created_at IS NULL or CAST(created_at as text) = '')
Upvotes: 3