Phase transitions in gels and a single polymer