Optional - Spray vinegar all over the ridge gourd and sprinkle some salt or baking soda. Let rest for 5 to 7 mins and then scrub them with a vegetable brush.
Rinse under running water and peel the ridges. Cut off both the ends. Cube them to 1 inch pieces.
Dry roast chana dal, urad dal and dried red chilies on a medium flame till you get a nice aroma. Add the cumin seeds and toast for a minute. Transfer this to a plate to cool.
Heat a wide pan with half of the oil. If you want to use green chili as a substitute to red chili, fry them in oil until blistered.
Add ridge gourd and saute till they are almost cooked. You can fry on high for the first 3 mins and reduce the flame. Cook covered until they soften. Transfer these to a plate to cool.
Add a teaspoon of oil to the same pan and add garlic, tomatoes, salt and turmeric. Saute till the tomatoes turn mushy and lose the raw flavor.
Transfer the roasted lentils, red chilies and cumin to the grinder and powder the, Add the rest of the ingredients - gourd, tomatoes and chilies. If you want you can also add little tamarind paste.
Grind to a coarse or smooth pachadi to your liking. Taste test and adjust salt.
Add oil to the pan for tempering and heat. Add all the ingredients except curry leaves and hing. Fry till golden.
Add curry leaves and fry till crisp. Add hing. Pour this tempering over the beerakaya pachadi.