# Rails app failing because I upgraded Rails

**URL:** <https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557>\
**Category:** Rails\
**Created:** [October 22, 2008, 9:38pm UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557 "2008-10-22T21:38:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 22, 2008, 9:38pm UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/1 "2008-10-22T21:38:09Z")

</div>

Hi,

Some time ago I ran “ruby script/server” and WeBrick server booted.  
Today, I ran the same command in the same directory (unchanged, I  
believe) and got:

# ======================== ./script/…/config/boot.rb:28: undefined method `require_gem' for main:Object (NoMethodError) from K:/_Utilities/ruby186-26_rc2/ruby/lib/ruby/site_ruby/1.8/ rubygems/custom_require.rb:27:in`gem\_original\_require’ from K:/\_Utilities/ruby186-26\_rc2/ruby/lib/ruby/site\_ruby/1.8/ rubygems/custom\_require.rb:27:in `require’ from script/server:2

My current versions are:  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]  
Rails 2.0.2

Environment variables named in The Rails Way (2.0) are:  
RAILS\_ROOT% =\> K:\_Utilities\Ruby\_1.8.2-15\ruby-trace\bin (Error:  
There is “ruby” but no “ruby-trace”)  
RAILS\_GEM\_VERSION =\> (Undefined)  
RAILS\_ENV =\> (Undefined)

I’m running WinXP-Pro/SP3.

Any suggestions?

TIA,  
Richard

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 22, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/2 "2008-10-22T21:59:56Z")

</div>

On Oct 22, 2:37 pm, RichardOnRails  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> rubygems/custom\_require.rb:27:in `gem\_original\_require’  
> RAILS\_ROOT% =\> K:\_Utilities\Ruby\_1.8.2-15\ruby-trace\bin (Error:  
> There is “ruby” but no “ruby-trace”)  
> RAILS\_GEM\_VERSION =\> (Undefined)  
> RAILS\_ENV =\> (Undefined)
> 
> I’m running WinXP-Pro/SP3.
> 
> Any suggestions?
> 
> TIA,  
> Richard

What does gem -v report?

Jeff

[purpleworkshops.com](http://purpleworkshops.com)

> **[Hey Daddio!](http://softiesonrails.com)**
>
> Home of Hey Daddio Software

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 22, 2008, 10:12pm UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/3 "2008-10-22T22:12:52Z")

</div>

Hi, does your environment.rb reflect the version that’s installed?

-Conrad

Sent from my iPhone

On Oct 22, 2008, at 12:37 PM, RichardOnRails  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 22, 2008, 10:15pm UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/4 "2008-10-22T22:15:48Z")

</div>

Also, you might want to run the following command after you update  
environment.rb:

rake rails:update

Sent from my iPhone

On Oct 22, 2008, at 12:37 PM, RichardOnRails  
\<removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 22, 2008, 10:17pm UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/5 "2008-10-22T22:17:55Z")

</div>

When you upgrade rails, a lot of things can become deprecated: ie. I  
think that the function “require\_gem” is now just “require”

You can see where this is being called into by going to line 28 of your  
config/boot.rb file.

if you want to update this to run on the new version of rails, you can  
run from your root: “rake rails:update:configs”

Something else to look into when you upgrade your rails, is freezing the  
apps that you have successfully running on older versions:

> **[Freezing Rails | Tiger Technologies Support](https://support.tigertech.net/freeze-rails)**
>
> If you are using Ruby on Rails and want to ensure maximum stability, you should "freeze" the version of Rails you use.

do you know which version you upgraded from?

JP

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 23, 2008, 12:11am UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/6 "2008-10-23T00:11:49Z")

</div>

Hello All,

Many thanks for all your suggestions. I’m going to respond to all of  
them here. But first an embarrassing admission: When I did the same  
thing (I think) as I did earlier today, I got the expected result:

K:\_Projects\Ruby\_Rails\_Apps\Rails\_2.0\_Demo\>ruby script/server  
=\> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)  
=\> Rails application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server  
\*\* Starting Mongrel listening at 0.0.0.0:3000  
\*\* Starting Rails with development environment…  
\*\* Rails loaded.  
\*\* Loading any Rails specific GemPlugins  
\*\* Signals ready. INT =\> stop (no restart).  
\*\* Mongrel 1.1.4 available at 0.0.0.0:3000  
\*\* Use CTRL-C to stop.

Sorry about the false alarm. However, I will gain from your  
suggestions.

> Jeff: What does gem -v report?  
> 1.0.1

> Conrad: Does your environment.rb reflect the version that’s installed?  
> RAILS\_GEM\_VERSION environment var is undefined  
> environment.rb sets RAILS\_GEM\_VERSION = ‘2.0.2’  
> rails –v =\> Rails 2.0.2

> Conrad: Run the “rake rails:update“ after you update environment.rb:  
> Will do in the future. Thanks

> Jason: I think that the function “require\_gem” is now just “require” [snip]  
> line 28 of your config/boot.rb file.  
> There’s no “require\_gem” in config/boot.rb  
> To update to the new version of rails, run from your root: “rake rails:update:configs”  
> Nice to know, Thanks  
> Freezing apps that run on older versions: [Freezing Rails | Tiger Technologies Support](http://support.tigertech.net/freeze-rails)  
> Nice to know, Thanks

Again, thanks to all of you. You’re a great bunch!

Best wishes,  
Richard

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 23, 2008, 5:56am UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/7 "2008-10-23T05:56:18Z")

</div>

Hi Jason,

Thanks for following up on this. I never noticed that I should at  
line 28 of the boot.rb file when the problem occurred. The problem  
now (or the good news is) when I tried to run the app today, it ran  
fine. So there’s no debugging to be done because I don’t know how I  
caused the crash.

I’ve just started a new app along the lines of the one that I got  
running on my second try. And as you might expect, I encountered a  
migration problem. I going to post that on a new thread, and I hope  
you’lll take a look at it. This time I’m saving all the relevant  
windows until I get a resolution to this new one.

Again, thanks for posting again on my problem.

Best wishes,  
Richard

On Oct 22, 7:01 pm, Jason P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [October 23, 2008, 1:01am UTC](https://www.ruby-forum.com/t/rails-app-failing-because-i-upgraded-rails/151557/8 "2008-10-23T01:01:32Z")

</div>

> > Jason: I think that the function “require\_gem” is now just “require” [snip]  
> > line 28 of your config/boot.rb file.

Hey Richard,

no it may not be there, but you have this error in your log from above:

> > ./script/…/config/boot.rb:28: undefined method `require\_gem’ for  
> > main:Object (NoMethodError)

so boot.rb is calling a function in a file somewhere else, which may  
in-turn be calling another file somewhere with “require\_gem” inside of  
it. Sometimes tracking this down is a pain, however that’s what the  
stack trace is good for. It can often help you discover where the  
problem is, in this case I would’ve guessed it was with a version of  
rails or a version of gems - the older of which would have been calling  
“require\_gem”, the newer of which would have been calling “require”.
