How could I make compost that doesn't attract rats?
We feel your pain! Confession: We also had rats once upon a time (ugh, big ones! long tails! greasy marks all along the baseboards! in the basement.) We live in cities + other creatures live and thrive in cities. Whenever there is construction along (especially) river edges, where the ratty animals normally can live and eat, they decamp to, well, composters and basements. (I would too, if there was a backhoe up my ass.) But seriously. Here's what we do, and strongly advise:
FIRST: Never ever ever under any circumstances add anything PROCESSED or COOKED to a backyard composter. Nothing. Zip. Nada. Relatedly, never put "compostable take-out" CONTAINERS in the compost bin if they had cooked food or drinks being in them, including "compostable coffee cups" that you bought and filled with cream and sugar. Sorry, nope. THIS MEANS: IF you have a peeny-weeny dried-up tablespoon of cooked rice on your plate, a crust of bread from a kid's lunch sandwich, and two little blips of fried onions, those MUST go into the MUNICIPAL GREEN BIN. Same with crackers, granola bar bits, cheese crumbs, chocolate chips, plantain chips, noodles, dried or cooked, canned pumpkin, anything that was processed and-or cooked. There are oils and fats and smells in all those items that attract animals. (Worm bins are slightly different matters, and you can ask about that but for a BACKYARD COMPOSTER, this is A HARD NO. (If you have an abandoned compost bin in the backyard that is chewed through and half-full.... I think what you need to do is get rid of the whole thing and start again. You can always always dig a hole and put the remains of the half-digested compost gunk into it, and cover it up. It will become soil, and won't attract animals like that).
SECOND: Always, always COVER whatever you throw into the backyard composter, even if it is inside a black plastic bin and has a lid. This looks after smells that act as aromatic invites to all manner of city creatures (skunks, raccoons, possums, and yes, Mr. Ratty) .... and also ensures that your composted stuff becomes, well, good compost. Most of what comes out of a home that can be composted in the backyard is high in NITROGEN. So, there is a need for carbon to be added, in layers, always on top of the fruit and veggie scraps. What we do is this: When they are available, cover with fresh fallen leaves. If not leafy, then woody will do! Go find some sawdust (we grab those GIANT bags behind Old World Woodworking. You can also get free sawdust from Angelo's on Morris St. There are a zillion places that produce sawdust: you have to source this. Don't pay money, for goodness' sake. Keep that bag RIGHT beside your compost system. Every single time you toss your house bin of kitchen scraps into your backyard composter, cover it entirely with a thin layer of sawdust. You can also use shredded non-glossy paper; again, ask around: places are dying to get rid of it. Surely you have paper in your house that needs to be "edited"? That can be the layer of "carbon" that goes on top of the vegetable and fruit scraps in the backyard composter.