Reputation: 14275
I would like to create a new model for a Ruby on Rails application. I know that this should do:
$ ruby script/generate model Book
But it gives me:
ruby: No such file or directory -- script/generate (LoadError)
Why is that? How can I fix that? I am in my application folder.
Upvotes: 0
Views: 74
Reputation: 915
What version of rails are you running? As far as I know it should be script/rails
- but I am running rails 3.1.3
Edit: as @Jeremy bellow stated, in rails 3 and up it is script/rails
- or of course, more generally, just rails
Run
ruby script/rails -h
and you should see the available commands
Run
ruby script/rails generate -h
to see what is available to generate
Alternatively, you should also just be able to run:
rails generate -h
I have never found the ruby script/rails
portion to be necessary, it defaults to that automatically
Upvotes: 2
Reputation: 176635
If you're using Rails 3, you do it like this:
$ rails generate model Book
The way you tried is the old way. Maybe you're following an old tutorial or something.
Upvotes: 1