Rails 4 fix for #951