Adaptation for Rails 4