How do I properly insulate an attic ceiling?
If you are foaming the attic ceiling, you're converting the attic to conditioned space. If you do this, you must cover up the ridge, eave and gable vents (or any other vent, for that matter)

Here is an information link on the subject:

http://inspectapedia.com/interiors/atticcond8.htm