There is a pretty good account of how this works in [Karl Schwede][1]'s [paper][2]:

MR2182775 (2006j:14003) 

Karl Schwede, 
*Gluing schemes and a scheme without closed points.*

Recent progress in arithmetic and algebraic geometry, 157–172, 
Contemp. Math., 386, Amer. Math. Soc., Providence, RI, 2005


  [1]: http://mathoverflow.net/users/3521/karl-schwede
  [2]: http://www.ams.org/mathscinet/search/publdoc.html?pg1=IID&s1=773868&vfpref=html&r=11&mx-pid=2182775