i think you can do ConfigTemplate.find_or_create_by_name