I really think someone pulled your leg there. Peanut butter is a great bait, but also perfect food. If you mix it with plaster of paris, that's a different thing.
Just did a search for onions, well, yes, they are toxic to rats, but I highly doubt a wild rat would eat enough even when mixed with peanut butter, it's not easy to poison a wild rat fast enough before it wiped out some more rabbits - but that sure is worth a try, dosn't cost much.
Looking for some fun and interesting answers to do onions kill rats? Learn about this amazing fun fact and much more!
kidadl.com
Still, set good quality snap traps.
Playing around with diy improvised live traps can be done, but I wouldn't relay on it.