Rats are naturally attracted to a compost bin for its food source and for potential habitat. Composting should be done in a rodent proof structure. Turn your compost regularly to ensure critters don’t take up residence. Add sufficient nitrogen to keep the compost hot. This will break down food scraps quickly making them less attractive to rodents.