Machine output

fixed the loop bug (non-kludge version)
I wrote a comment in the now-accepted pull request explaining what was happening.  short version:
1. request sets selected_revision_id (current at the time but file doesn't exist)
2. output gets updated, sets new current_revision_id in db, but 
3. selected_revision_id does not change.  attach.rb uses this old srid in filename
4. redirect back to output url using current revision id
5. back to step 1

Fix addresses step 3.