It has happened to me. I have put the rubbish bag outside overnight only to be welcomed in the morning to all the trash spread all over the yard.
To keep all animals out of the trash for those whom have to set it out to the curb for pick-up, simply spray it and/or the outside of the container with ammonia.
Other things that will keep the animals away are moth ball flakes sprinkled on the bags or ant/roach killer. The animals that are bugging you will keep away as they do not like the smell.