Rails 4 compatibility fixes.