Reputation: 10744
I have a model Post
with 2 attributes:
attr1
and attr2
I want check that either attributes have a value defined or are different from "nil".
How can I do it?
Thank you!
Upvotes: 0
Views: 64
Reputation: 10744
The solution for this problem is the next query:
Post.any_of({ :attr1.ne => nil }, { :attr2.ne => nil})
Thank you very much!. Regards!
Upvotes: 1