substitute where()[0] with find_by()