I learned that I can not put -ing form after the infinitive-to; I should put base form of verb after the infinitive-to.
However, in this sentence, (this is from my textbook.)
They were able to dedicate all of their time to ensuring that I did well in school.
I can see ing form is used after infinitive to.
I am curious that why this sentence is grammatical even though it violates the constraint, and I want to know if I can change given sentence into They were able to dedicate all of their time to ensure that I did well in school.