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

前端 未结 3 1952
死守一世寂寞
死守一世寂寞 2020-12-10 00:11

OS is Ubuntu 12.04, 64 bit.

New to rails. Relatively new to Ruby. Following the ruby.railstutorial.org tutorial, chapter 3.

The tutorial has been updated to

相关标签:
3条回答
  • 2020-12-10 01:09

    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.

    0 讨论(0)
  • 2020-12-10 01:11

    'activeresource' is available as a separate gem from Rails 4

    0 讨论(0)
  • 2020-12-10 01:18

    I had same error. what I made is: in Gemfile I changed version of rails: gem 'rails', '4.2.0' Then on command line executed this command: bundle install. To see what generators available to us type rails g or rails generate on CLI.

    0 讨论(0)
提交回复
热议问题