Bring over factory attribute builder from rails4 branch