Rats in the community garden
We do not have a recommendation for you that is researched based. However, there are plenty of what you can consider anecdotal suggestions on the internet when you search for 'plants that deter rats'. You can certainly experiment with them.
Here is our rat webpage: https://extension.umd.edu/hgic/topics/rats
If the community garden has a compost pile that is attracting rats, it needs to be caged and contents should not include food or edible crop items unless they have been already partially composted before being added.
A tip: Sprinkling lime on fruits (including tomatoes) can be effective at deterring critters. It washes off easily when you harvest, and also must be reapplied after rains.
A last suggestion: don't bother letting tomatoes ripen on the vine. They can be harvested as soon as they begin to color. The longer they stay on the vine, the more attractive to pests.