Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby Error: "No such file or directory -- script/generate (LoadError)"

I know that this error has been discussed elsewhere on the web, and this may seem like a stupid question, but I've got a very strange situation on my hands here.

I'm running on Snow Leopard, with fully updated Ruby and Rails gems. I created a new Rails project using ruby new testing, then navigated into that folder using cd ~/testing, and tried to create a basic scaffolding using ruby script/generate scaffold newtest name:string, and I got this error back:

ruby: No such file or directory -- script/generate (LoadError)

I have searched Google thoroughly and tried to implement every solution that I could, but nothing has been working. I don't understand why I have this error or how to fix it.

like image 315
Jenius Avatar asked Feb 07 '11 23:02

Jenius


2 Answers

If you are on rails 3 then the command is:

rails generate scaffold newtest name:string

Or the slightly shorter:

rails g scaffold newtest name:string

Notice rails not ruby.

like image 152
Gazler Avatar answered Sep 28 '22 06:09

Gazler


If you're on Rails 3, you need to use the rails command instead, which now does much of the scripting.

(This is according to another StackOverflow question.)

like image 29
Platinum Azure Avatar answered Sep 28 '22 06:09

Platinum Azure