Works for Rails 4