简体   繁体   中英

Ruby on Rails on Mac not generating model

When I type into the terminal rails generate model Message , this comes up in the terminal and there is no model called Messages. What should I do? I am using El Capitan. This is the Picture

You can generate a model by

rails generate model Article title:string text:text 

as copied from this page You can also generate a controller by

rails g controller controllername new create

You are getting this error because you have probably created a new rails project but you have not navigated into the folder of that project yet. So cd into-the-name-of-project and then you can successfully generate models and controller there.

And if you have not created the project yet, run this command - rails new name-of-project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM