The AddPositionToAttachments migration broke when it executed Page.all(:include => :attachments).each do |page| (I think this was the line). It created a MySQL error because the parent_id didn't exist, yet, but the code assumed it did.
I also edited some self.down methods so we could undo migrations cleanly; there were some errors in those methods, too.
Fixed bugs in migrations.
Namespaced AssetsHelper and moved it to an admin subfolder.
I tried to isolate the migration fixes by changing the source for this pull request to my migrations branch. That apparently didn't work. Use caution if you decide to pull in commit 027e14d.
Added back some code I removed.
You may want to ignore commits 027e14d and 66811c8. They were never meant to go with this pull request :(
The methods shouldn't have been deleted. I was initially going to have some methods in Admin::AssetsHelper and others in AssetsHelper, but I later decided not to. I didn't restore all the methods I removed from this file. I added those back in another commit.