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.
What version of rails are you running? As far as I know it should be
script/rails– but I am running rails 3.1.3Edit: as @Jeremy bellow stated, in rails 3 and up it is
script/rails– or of course, more generally, justrailsRun
and you should see the available commands
Run
to see what is available to generate
Alternatively, you should also just be able to run:
I have never found the
ruby script/railsportion to be necessary, it defaults to that automatically