Forum: Ruby on Rails Rails app failing because I upgraded Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
31fdda5f38fc6df4e193cfb7445ddc5a?d=identicon&s=25 RichardOnRails (Guest)
on 2008-10-22 21:38
(Received via mailing list)
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
8217faf2bfdfa7daf10135d41ddd421e?d=identicon&s=25 Jeff Cohen (jeff)
on 2008-10-22 21:59
(Received via mailing list)
On Oct 22, 2:37 pm, RichardOnRails
<RichardDummyMailbox58...@uscomputergurus.com> 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
softiesonrails.com
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (Guest)
on 2008-10-22 22:12
(Received via mailing list)
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
<RichardDummyMailbox58407@uscomputergurus.com
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (Guest)
on 2008-10-22 22:15
(Received via mailing list)
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
<RichardDummyMailbox58407@uscomputergurus.com
E25296bf52723dc37bc462271eb02d2d?d=identicon&s=25 Jason Pfeifer (jpfeifer)
on 2008-10-22 22:17
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:
http://support.tigertech.net/freeze-rails

do you know which version you upgraded from?

JP
31fdda5f38fc6df4e193cfb7445ddc5a?d=identicon&s=25 RichardOnRails (Guest)
on 2008-10-23 00:11
(Received via mailing list)
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
=> 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: http://support.tigertech.net/freeze-rails
Nice to know,  Thanks

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

Best wishes,
Richard
E25296bf52723dc37bc462271eb02d2d?d=identicon&s=25 Jason Pfeifer (jpfeifer)
on 2008-10-23 01:01
>> 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".
31fdda5f38fc6df4e193cfb7445ddc5a?d=identicon&s=25 RichardOnRails (Guest)
on 2008-10-23 05:56
(Received via mailing list)
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 Pfeifer <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.