Issue loading rails 3 (server) after coming back from 3.1

后端 未结 2 535
野趣味
野趣味 2021-01-28 23:31

total noob to rails and am using the Hartl tutorial.

Got to chapter 4 (CSS, 4.1.2), everything seemed dandy, and ran into an issue getting



        
2条回答
  •  执笔经年
    2021-01-29 00:23

    Per the answer to Trouble loading Rails Server (3.0.11, ruby 1.9.2), no such file to load -- sprockets/railtie (LoadError), you should remote Rails 3.1-specific lines from auto-generated files, mostly in config/.

    One way to figure out what lines to remove is to compare your app to a fresh Rails 3.0 app using diff -r

    Step 1: Create a clean Rails 3.0 app

    $ rails --version
    Rails 3.0.10
    
    $ rails new fresh_app
          create  
          create  README
          create  Rakefile
    

    Step 2: Use diff -r to compare the directories

    $ diff -r hartl_tutorial/config fresh_app/config
    diff -r hartl_tutorial/config/application.rb fresh_app/config/application.rb
    5,10c5,7
    < if defined?(Bundler)
    <   # If you precompile assets before deploying to production, use this line
    <   Bundler.require(*Rails.groups(:assets => %w(development test)))
    <   # If you want your assets lazily compiled in production, use this line
    <   # Bundler.require(:default, :assets, Rails.env)
    < end
    ---
    > # If you have a Gemfile, require the gems listed there, including any gems
    > # you've limited to :test, :development, or :production.
    > Bundler.require(:default, Rails.env) if defined?(Bundler)
    

    In case you don't know how to read a diff, the basic idea is that lines starting with < are from one file while lines starting with > are from the other file.

提交回复
热议问题