.exists?


#1

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)


#2

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