Add workaround for activesupport 4.0.0 bug.

Adds a workaround for an activesupport 4.0.0 circular reference bug
(rails bug #12876 - https://github.com/rails/rails/issues/12876).