Rails2 update

We needed this functionality at work, but it wasn't working very well in rails 2 (we'll be updating soon but I needed it now). Hope this helps support your project!