rails generate model

后端 未结 4 1180
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-24 10:31

I\'m trying to follow instructions from the book \"Head First Rails\" and on page 50 it says to create a model but I am unable to create a model using the rails command.

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 11:12

    The error shows you either didn't create the rails project yet or you're not in the rails project directory.

    Suppose if you're working on myapp project. You've to move to that project directory on your command line and then generate the model. Here are some steps you can refer.

    Example: Assuming you didn't create the Rails app yet:

    $> rails new myapp
    $> cd myapp
    

    Now generate the model from your commandline.

    $> rails generate model your_model_name 
    

提交回复
热议问题