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

后端 未结 2 534
野趣味
野趣味 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.

    0 讨论(0)
  • 2021-01-29 00:25

    im in the same boat as you, i am running rails 3.1.3 and am not in the mood atm to start over for a lower rails (or to figure out how to seamlessly change rails version).

    i decided to remove the blueprint folder and its two including lines in application.html.erb, and make a new inclusion of a custom css file i put directly in app/assets/stylesheets. the css was just to make the background red, and thats what it did. not sure why our pages were being centered like that using the blueprint, but it looks okay now. as mentioned earlier, the safest bet is to just use the same versions as the tutorials, or 3.0.11 for rails as mr. hartl has indicated in a comment.

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