re-added changes from GitHub user alvinschur

Original repo with changes was at https://github.com/alvinschur/activeresource