how to create an object if none exists rails code example Example: create if not exists rails Contact.where(survey_id: survey,voter_id: voter).first_or_create