Newbie on “Script-Generate”

I am a newbie to Ruby on Rails and I am trying to learn it.

At the moment, I am using ruby tutorial that is about 5 years old.

I am stuck on the 2nd page of the tutorial where I am generating a script or the controller in the command window.

C:\rails> ruby script\generate controller MyTest 
ruby: No such file or directory script/generate (LoadError)

What are my alternative to generating the script? And if possible, can someone show me a tutorial that isn't so outdated?

Much appreciated

14.10.2009 01:00:16

I could be wrong, but that could be a problem with ruby on windows, what version of ruby are you running? Type ruby -v in the console.

Another reason could be that you are probably not in a rails application directory. You have to create a rails application by creating a directory, and then doing rails thedirectory/ in the console, which will initialize all of the rails files for you. Once done, you cd into the directory and should be able to run the script/generate script.

Also, this is by no means a definitive source, but the Rails Guides site is pretty good.

14.10.2009 01:04:00
ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
Anraiki 14.10.2009 01:13:53
Oh thanks for pointing that out. I just google for a tutorial and it showed me that one and I thought this one would do.
Anraiki 14.10.2009 01:15:16

As for a tutorial, looked at Getting Started with Rails?

14.10.2009 01:04:25
Thanks for the link, I have not, and I will
Anraiki 14.10.2009 01:19:44

Seems like you're not in the right folder. If you're following the tutorial you linked, you need to 'cd cookbook' from the c:\rails folder.

14.10.2009 01:34:41
Doh! Didn't think I had to be in the directory of the Cookbook. Thanks :)
Anraiki 14.10.2009 06:03:52