Deployment syntax error: fine in dev - what's happening?

I'm deploying an app (using Capistrano) to a staging server prior to
final deployment. The app runs fine in dev, but in staging it throws a
syntax error. How can that be?

Well the code looks wrong to me - inside the begin you have each
unless and if, but only 2 ends before the rescue (you don't seem to
have indented the each).
A big difference between development and production is that in
development files are loaded when needed, so if there is a syntax
error you hear about it when that file is used, whereas in production
rails loads all your classes up front so you get the error upon