Also works for Rails 4