Two RoR probs: script\console "no such file to load" error, test "rake aborted!"

Hi,

I am a newb to RoR but finding it much more difficult than most people
maintain. I'm trying to follow a beginner's tutorial and have
meticulously followed each step but keep running into problems. Just
in case, I have even tried everything on two different machines with no
luck.

(The tutorial is by Obie Fernandez and can be found on page 14 of
http://www.ratio.co.uk/ov9pdf.pdf.)

My two machines are both Windows XP; for the first I installed
everything piecemeal (Ruby, Rails, MySQL, etc) and for the second I
used InstantRails. They both SEEM to be working in every way except
for the problems given below. I have searched numerous posts and sites
for some answers, but though people seem to be encountering these
problems no one has suggested a solution that works for me. PLEASE
help, if you can--I would so appreciate it!

ERROR 1: This is the error I get when trying to run a Ruby console (a
la page 19 of the tutorial). Interestingly I did not get this error
before starting the tutorial.

C:\user\example>ruby script\console
Loading development environment.
c:/Ruby/lib/ruby/1.8/irb/init.rb:252:in `require': no such file to load
-- ./script/../config/../config/environment (LoadError)
        from c:/Ruby/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
        from c:/Ruby/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
        from c:/Ruby/lib/ruby/1.8/irb/init.rb:21:in `setup'
        from c:/Ruby/lib/ruby/1.8/irb.rb:54:in `start'
        from c:/Ruby/bin/irb.bat:20

ERROR 2: This is the error I get when trying to run a generic test
(nothing customized yet) using rake (a la page 20 of the tutorial):

C:\user\example>rake
(in C:/user/example)
c:/Ruby/bin/ruby -Ilib;test
"c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
c:/Ruby/bin/ruby -Ilib;test
"c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
rake aborted!
Test failures

In case you are interested to see the whole trace (using --trace), it
is as follows:

C:\user\example>rake --trace
(in C:/user/example)
** Invoke default (first_time)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:test:prepare
** Invoke db:test:clone (first_time)
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
** Execute db:test:clone
** Invoke db:schema:load (first_time)
** Invoke environment
** Execute db:schema:load
** Invoke test:functionals (first_time)
** Invoke db:test:prepare
** Execute test:functionals
c:/Ruby/bin/ruby -Ilib;test
"c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
** Invoke test:integration (first_time)
** Invoke db:test:prepare
** Execute test:integration
c:/Ruby/bin/ruby -Ilib;test
"c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
rake aborted!
Test failures
c:/Ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/tasks/testing.rake:35
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
c:/Ruby/lib/ruby/1.8/thread.rb:135:in `synchronize'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
`invoke_prerequisites'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
`invoke_prerequisites'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
c:/Ruby/lib/ruby/1.8/thread.rb:135:in `synchronize'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
c:/Ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
c:/Ruby/bin/rake.bat:25

Does anyone have any clue what is going on? As I say, I have searched
numerous groups and sites and can't find any answers to these two
problems. Please do help!

Many thanks in advance,
TOM

Hi all,

I've figured out at least an immediate workaround to the first error.
Hope this saves some other people some time. You simply run ruby with
the entire path indicated:

ruby c:\user\example\script\console

That's it.

TOM

Are you opening your command window through Instant Rails ("Rails
Applications > Open Ruby Console Window")? This is important because
it ensures that the ruby\bin directory for the copy of ruby included
in IR is first on your system path.

Also, when using Instant Rails, your rails applications need to be
inside of the ...\InstantRails\rails_apps directory.

And, finally, when you try to start up the rails console via "ruby
script\console" your current directory *must* be the root directory of
your rails application.

Make sure all three conditions above are true and try again -- it should work.

Curt