Merge from Upstream, Rails 4 Compatibility