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