Create if record does not exist September 5, 2023 by Tarik You can do the following: Contact.where(survey_id: survey,voter_id: voter).first_or_create