Fix a bug with Rails 4