Search code examples
ruby-on-railsscaffolding

Rails Scaffolding issue in windows


rails scaffold chatroom name

rails aborted! Don't know how to build task 'scaffold' (see --tasks) bin/rails:4:in require' bin/rails:4:in'


Solution

  • You are missing the generate keyword, and the datatype of the field name, so your command should be:

    bin/rails generate scaffold ChatRoom name:string
    

    Note the camelCase in ChatRoom, in this case Rails will generate snake_case names for your files, (i.e. app/controllers/chat_rooms_controller.rb. If you dont want this kind of names, change ChatRoom to Chatroom and you will get app/controllers/chatrooms_controller.rb.