Changes to compatibility with Rails 3 and Rails 4