update if exists rails code example Example: create if not exists rails Contact.where(survey_id: survey,voter_id: voter).first_or_create