Strange Inability to Require Config/Boot After Upgrading to Ruby 1.9.2

strange inability to require config/boot after upgrading to ruby 1.9.2

Replacing line 2 of script/server with

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

works for me (taken from Rails 3)

What is the right place to require a ruby module in rails 3 & ruby 1.9.2?

Put it in 'config/application.rb'. (See "Configuring Rails Applications").

In general, do this stuff in a central place and document it. The person maintaining your application will appreciate it when some future Ruby or Rails version breaks all kinds of backward compatibility.

What is the right place to require a ruby module in rails 3 & ruby 1.9.2?

Put it in 'config/application.rb'. (See "Configuring Rails Applications").

In general, do this stuff in a central place and document it. The person maintaining your application will appreciate it when some future Ruby or Rails version breaks all kinds of backward compatibility.

environment first or boot first?

The environment.rb is the main Rails environment file. It requires the boot.rb file but the boot.rb is run before Rails::Initializer.run. In fact, the last line of boot.rb contains the following statement

# All that for this:
Rails.boot!

Please note that while the environment.rb file belongs to your Rails app, the boot.rb file is automatically updated each time you run the rake task

rake update:rails

You should never modify that file.

To better understand how Rails initialization works, Sven wrote a really helpful article called The Rails startup process from a paragliders perspective.

no such file to load -- rubygems (LoadError)

I have a hunch that you have two ruby versions. Please paste the output of following command:

$ which -a ruby

updated regarding to the comment:

Nuke one version and leave only one. I had same problem with two versions looking at different locations for gems. Had me going crazy for few weeks. Put up a bounty here at SO got me same answer I'm giving to you.

All I did was nuke one installation of ruby and left the one managable via ports. I'd suggest doing this:

  1. Remove ruby version installed via ports (yum or whatever package manager).
  2. Remove ruby version that came with OS (hardcore rm by hand).
  3. Install ruby version from ports with different prefix (/usr instead of /usr/local)
  4. Reinstall rubygems

Unable to run rails console

Start using RVM. Put your gems for a project in a separate gemset or just create a .rvmrc. You will never run into such issues.

However, I was once struck with same error and uninstalling the gem and reinstalling it manually worked for me.

Uninstall a gem:

gem uninstall <gem_name>

It will prompt for the version to remove if there are multiple versions of that gem on your system.

Then, Install a gem:

gem install <gem_name_with_version>

Upgrading to Rails 3.2.2: How to solve the 'undefined method for Syck::DomainType' error related to the Delayed Job gem?

We managed to solve Syck / Psych weirdness in our app by ensuring that setting the YAML parser to Syck was the absolute first thing done when initializing. The reason you can sometimes run into issues is that DelayedJob initializes differently depending on which YAML parser you're using, and if the parser changes during initialization, DelayedJob will probably get it wrong.

Add this to the very top of boot.rb, and see if it helps:

require 'yaml'
YAML::ENGINE.yamler = 'syck'


Related Topics



Leave a reply



Submit