This is correct:
"Rats," he said.
But this looks wrong to me:
"I left the oven on. Rats," he said.
I can't find any rules about whether you can end a quotation with a comma when there are periods inside the quotation. How would you write the second sentence?