# .exists?

**URL:** <https://www.ruby-forum.com/t/exists/107831>\
**Category:** Rails\
**Created:** [June 26, 2007, 5:09pm UTC](https://www.ruby-forum.com/t/exists/107831 "2007-06-26T17:09:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![revanche](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@revanche](https://www.ruby-forum.com/u/revanche)\
**Post date:** [June 26, 2007, 5:09pm UTC](https://www.ruby-forum.com/t/exists/107831/1 "2007-06-26T17:09:15Z")

</div>

Is there any way to use .exists? to check multiple conditions? Ideally,  
I’d like to verify it against four other fields. Thanks in advance!

if Contact.exists?(:mobilephone =\> @contact.mobilephone)

---

<div class="post-metadata">

**Author:** ![revanche](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac91a4/32.png) [@revanche](https://www.ruby-forum.com/u/revanche)\
**Post date:** [June 26, 2007, 5:22pm UTC](https://www.ruby-forum.com/t/exists/107831/2 "2007-06-26T17:22:50Z")

</div>

Model.exists?(:attr1 =\> “x”, :attr2 =\> “y”, :attr3 =\> “z”)

note that the the conditions will be ANDed. if you need to use OR,  
then you need to use a different conditions format

Model.exists?([“attr1 = ? OR att1 = ?”, x, y])

Chris
