Rats can be a problem, as they can injure chicks, eat chicken food, and steal eggs. However, if your coop is secure by night and you do not have any chicks, rats may not be a problem that you need to get rid of. However, if they are causing issues of some kind, then one of the best methods I know is to get a good hunting cat, one that won't go after chickens, and just let it live around the barn. We've had cats as long as we have had chickens and trust me, they are great hunters. They left the chickens, chicks and eggs alone but go after weasels, sparrows, rats, mice, voles, and even rabbits. Just make sure the cat is good around chickens (such as raise it around them) as we had a stray tomcat that actually hunted are chickens as well.
As I said, if a predator is not causing a problem then there is no reason to get rid of it as this just opens up a territory for predators that are dangerous. If the rats are just eating eggs you could try securing the coop against them to prevent this. If they are eating food, keep all the food in a secure bin by night and only leave out food by day, which rats generally are in hiding. Rats are very smart about traps and can build up tolerance to poison (one of the main reasons I advice against it, as super rats sound scary to me). Not to mention chickens may eat a poisoned rat and die themselves.
I hope this helps. Best of luck!