If you can't have a compost heap, you can direct compost by digging down at least six inches into open ground, burying the kitchen scraps (not cooked food or meat), then covering back up with the soil. However, this isn't really possible in a pot - the scraps would be inserted amongst the plant roots, and every time you want to add a scrap or two, you'll be disturbing the roots of your potted plant, which is not a good idea. They also, obviously, can't be buried deep enough in a pot, so they are indeed likely to attract foraging animals (rats etc).
In addition to Bamboo's answer. General kitchen waste also decomposes rapidly and resulting in considerable heat production which can damage the root. It can also induce the proliferation of decomposers temporarily and they will use up some of the nutrients in the original soil.
You can indeed shred the kitchen waste with a food chopper and mix this with the same amount of garden soil in a bucket. Stir it every two days for aeration. And in 2-3 weeks the microbes (depends on temperture) will quickly eat up all the waste and you will end up with a good living soil. Make shure the shreded waste is not to wet, just humid.
Since I've been doing my container garden, I also make my own compost. I have experimented with banana peels, tomato peels, potato wedges, egg shells, and even threw a couple of red worms in the pot also that I had leftover from fishing so they can help the process and leave their casting and my plants loved it. The egg shells took a while to break down because I had them on top to prevent little pest from crawling on my veggies and leaves. But overall I think it works pretty well. It takes a while for scraps to break down so try not to go overboard with crowding the pot. I also tried taking a raw egg and when I transplant my seedling I bury it in soil and compost and the plants take off especially tomatoes and peppers. So the next time you boil some eggs save the shells and water to use on your plants. They love calcium... Hope this helped...
Another option to consider, assuming you have room to add more soil to the pot is to put your kitchen scraps in the pot and layers those with soil so it is fully covered and does not attract rodents. This will avoid you having to dig the soil in the pot and potentially damage the roots of the existing plant.
try leaving your peelings and all vegetable food waste in a bucket then compress this waste with another bucket placed inside the first bucket... then compressed down sealing most of the odors in and the vermin out... when this is well rotted and therefore not attractive to rats then place around the top of your plant pots not digging or disturbing the roots then water through the mulch... start off sparingly.. then ajust to suit your self
If you can't do traditional thermophilic composting, several other forms of composting are easy to do indoors or with limited outdoor space. The one that seems most accessible is worm composting or vermicomposting. In all composting systems, it's the beneficial bacteria, arthropods and nematodes who do the actual work of breaking the material down and making the nutrients "plant available". The same is true for worm-composting, that the bacteria is doing most of the work, but the worms then eat the bacteria and super-charge the resulting castings (worm poop) with even more powerful microbes to help your plants.
Materials and process:
one of a few specific breeds of worms, with red wigglers being the most common variety but european night crawlers can work too.
a container, such as a 15 gallon plastic tub. Drill holes in the sides, bottom, and top.
some bedding, like newspaper, coconut coir, and/or leaves. The bedding should be wet thoroughly when starting the bin. It should feel as moist as a wrung-out sponge.
chop food to no more than 1-2 inches (2.5 to 5 centimeters) and add it to the bin. Worms seem to really like especially melons, coffee grounds,
Keep out certain foods like: meat/bone/dairy, citrus, acidic foods, foods high in sugar/oils, heavily processed foods, potatoes, weed seeds, anything that might have an herbicide or insecticide. When in doubt, use a search engine "can I put X in my worm bin" is commonly found in the search history of worm composters!
Add water to keep it moist. The worms will tell you they want less water by crawling to the top of the bin or they want more water by crawling down to the bottom where it's usually more moist.
Feed periodically by choosing a section of the bin you haven't put food into for a while, opening up a hole in the material, and burying the new food into that hole. Burying the food helps worms enjoy it all without being scared by light, reduces odors, and prevents small flies from finding the food. The worms will adapt to the surface area and amount of food you give them. If you see lots of food in the bin when you go to feed then you should slow down your feeding a little.
If you're doing everything right it won't smell and the worms won't escape, so you can keep the bin in a closet, under a sink, under your bed, etc.
Harvesting the castings:
A simple technique with few tool requirements is to just put handfuls of well processed material from your bin onto a surface like a cutting board. On a sunny day take it outside or put it under a light - the worms don't like light and will crawl down. After setting the pile down wait a few minutes for worms to go down. Then pluck the top 1/2 inch (1.5cm) of material off the pile and set aside. Wait 5 minutes for worms to crawl down and repeat until you have just worms at the bottom of the pile and can put them back into the bin. The material you took off the top can be further separated: big pieces go back in the bin, the smallest material you plucked off the top of the pile is the worm castings.
A method with less work but that requires tools is to get "hardware cloth" which is a grid of 1/8 inch (30mm) metal wire. Hardware cloth is usually sold in big rolls, but I've used this technique with a piece as small as 2feet square. Place your processed castings from your bin onto the grid, a few handfuls at a time. Jiggle the hardware cloth back and forth so the castings (and some worms) will fall through into a wheelbarrow or tarp or other catching device underneath. The bigger chunks of material left on top can go back into the worm bin along with any worms and cocoons that may have fallen through to the bottom.
Using the castings:
Once you've separated the castings from the worms and the bedding, you can use it in a few ways.
To use outdoors, just work the castings into the soil. A small amount goes a long way, so use a little casting mixed in near each plant.
To use castings indoors as a soil amendment in pots you should first let it dry out so that you are sure all the worms are dead (you don't want them crawling out of the pot). Then just work a little bit of castings into the top of the pot soil or mix it in when planting or up-potting.
You can make a great foliar treatment/compost tea from castings (though the steps are too many to go into here). This helps reduce disease and insect issues.