Replace ipairs with 'numeric for' in critical areas

The numeric for is more performant than ipairs, especially in LuaJIT.
See http://lua-users.org/lists/lua-l/2011-05/msg00008.html

This changeset performs this refactoring in areas where it might matter,
such as the common helpers, orm, and router.  Migrations, etc. were skipped.