In 4th grade my dog ate my homework but I wasn't able to use that as an excuse.
Were you able to get an extension, or to make another excuse?
No, I was able to lie cooly.
It's not ok that you lied about your homework. You should have told your teacher that your dog really did eat your homework, and perhaps shown one of the leftover scraps.
Oh shit I never thought about that.
Yes, it generally is the case that honesty is the best policy, especially in relatively low-stakes situations such as school.  If you tell the truth, and are prepared to accept the consequences, such as having to redo your assignment, you will be fine, and others will respect you for it.