Assuming there are exposed floor joists, the best way would be to install the foam on the bottom of the joists so that you have a continuous thermal break or spray foam over the entire joist bays and joist bottoms. But there might be obstacles such as ceiling lights, plumbing, wiring, garage door openers which make this not as desirable. Many people will go ahead and just install strips of foam insulation between the joists. I suppose one could use some sort of adhesive if you have the time. In most applications where I am putting foam overhead, I use screws with plastic washers so that the foam surface is protected from crushing by the screw head. This however depends on what thickness of your subfloor above is, what thickness the foam is and if you can get the proper sized screw that will work without protruding through your subfloor. Then you can go around and caulk any gaps around the edge of the foam. With foam, it is compressible enough you don't have to worry about expansion and contraction. A vapor barrier on any interior surface is not recommended unless specific conditions are met or you might create issues. For example, if there is a vapor barrier underneath your garage floor slab and one on the outside of the walls and you put one now in the ceiling, any moisture created in the garage such as when you open your door on a humid summer day has no place to go. Even if there are no other vapor barriers and you put one, where does any moisture go from that vapor barrier between condition and unconditioned space go? There is a lot of things to consider and investigate before a recommendation on a vapor barrier can be made.