cannot load railtie after upgrade to rails 4 per ruby.railstutorial.org

ActiveResource was an API added in Rails 2.x to support an XML (and later JSON) API so that Rails sites could “talk” to one another. It was a very hot topic when the idea of RESTful APIs made its way into the framework. Over time it became more of a novelty and infrequently maintained so it was pulled from the core in Rails 4.x.

You have two options at Rails 4.x. If you did not intend to use ActiveResource (I’d assume this is the case if you’re new to Rails and working on a tutorial) then you can simply remove or comment out the railtie that’s pulling it into the framework. Open up ‘config/application.rb’ and comment out the seventh line.

require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
# require "active_resource/railtie"    <--- comment out this line

If you WANT to use ActiveResource, then just add it to the Gemfile for the project. Previously it was included by the rails gem as a dependency; now you’ll have to add it explicitly if you want to use it.

Leave a Comment