Having rats around is no fun, and when you need to get rid of one you want it gone as soon as possible. Here's a time-honored way to do so whether inside or out. The main thing you need to be careful of is that no pets get at the trap - a rat trap could seriously injure or even kill a small animal. To prevent that happening to anything other than the undesired rodent, I offer a simple design for a box to house the traps and prevent pets getting anywhere near them.
Step 1: Traps
You have options here. You can buy sticky glue traps that adhere to the rat. You can buy traps that electrocute the rat. But I always use the trusty old snap trap, which administers a swift and reliable death by blunt trauma. I load them with a little peanut butter, which rats find irresistible. There are a number of tricks you can employ to increase the chances of the rat triggering the trap. Jamming a half-peanut on the trigger plate works well, as can wrapping some thread around the plate, but my preference is simply to set more traps. They're cheap and nasty, and I mean that as a compliment.
Step 2: Build an Enclosure
Both kids and pets are effective distributors of tasty treats for rats, who are attracted to scattered food from all sources. That doesn't mean little Johnny or Fido should be taught a harsh life lesson by having a sticky paw crushed by the unforgiving steel jaws of a mechanical trap. Be really, really careful to the point of paranoia about where you set up the trap. For my own peace of mind, I made a wooden enclosure to house armed traps. It's made of a few recycled plywood scraps. It houses three traps with space for the rats to hide while checking out the bait. I used 1/2" plywood and joined everything together with wood glue and nails.
2 plywood pieces 12" x 17" (top and bottom)
2 plywood pieces 17" x 6" (sides)
2 plywood pieces 11" x 6" (ends)
In the smallest pieces of wood, I cut entry holes for the rats. I made a 5-sided box, and attached the top with a set of old cabinet hinges (any hinges would be fine, they're just there to allow access to the box).
Pile stuff on and around the box so rats feel happy & safe approaching it. This box'o'rodent doom has been highly effective in trapping rats inside as well as outside in sheds, woodpiles and compost heaps - any place you think rats are setting up house. And I've never caught a cat/dog/raccoon/squirrel in it yet.
Step 3: Outside
There is an inexhaustible supply of rats outside, but they're particularly objectionable when they set up a nest in your woodpile or garden or garage or the walls of your house. We have problems with roof rats eating our strawberries, so I have an old steel wheelbarrow that I turn upside down and put in the middle of our vege garden. This accommodates a deadly array of four traps, and it's rare that a rat can clean all four without suffering a fatal accident while traversing this most challenging of obstacle courses. Don't despair if the traps do get licked clean - the rat has learned there are tasty, safe and easy pickings in that location and will return the next night with a terminal case of overconfidence.
Step 4: Squeamish?
No one really likes handling dead animals, especially ones that have had a lethal and kinetically energetic misadventure. Here's an easy and hygienic way to empty your trap with a minimum of fuss. Put on some gloves. Get a plastic bag. Pick up the trap by the end away from the dead rat and put it in the plastic bag. Using your other hand, lift the lever through the plastic bag and let the carcass fall into the bottom of the bag (shake the trap if necessary). Remove the trap, tie off the bag and dispose.
Teach your children how to do this so they can behave rationally when they encounter this scenario later in life. They won't enjoy it (adults don't, why should they?) but they will quickly realize it is no big deal and will be secretly delighted with their own bravery and capability.
If you're REALLY squeamish, throw the trap and rat into a garbage bag and dispose. Use a shovel to do this if you're ridiculously squeamish. This is an appalling waste of a perfectly functional trap, but apparently people do this (doubtless the manufacturers approve of this strategy). Not only that, the same people express surprise that I don't follow the same practice. What can I say, I like to recycle...
Feel free to share your best tips for catching vermin in the comments.