fix for rails-4.2.0.betaX

This stopped working in the Rails 4.2 beta. This seems to get it working, but it isn't comprehensively checked.