Search code examples
ruby-on-railsrubyruby-on-rails-4ruby-on-rails-5ruby-on-rails-6

Don't know how to build task 'script/generate'


I started learning ruby on rails today, and I always encounter some sort of error. I'm following the tutorial on tutorialspoint. Now when I ran rails script/generate model Book I encountered

rails aborted!
Don't know how to build task 'script/generate' (see --tasks)
bin/rails:4:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)

Solution

  • Drop the script part:

    rails generate model Book # will work
    

    P.S. Everyone starts with Hartl's tutorial, I think you should, too.