I am wondering how to use generate command to do something like this:
rails g model order customer
but it doesn't work.
Please show me how to do this, and how to check all the usage of this command?
A Rails Model is a Ruby class that can add database records (think of whole rows in an Excel table), find particular data you're looking for, update that data, or remove data. These common operations are referred to by the acronym CRUD--Create, Remove, Update, Destroy.
The generate command in Rails is a powerful tool that you can use to streamline workflow. You can use the generate command in the command line to quickly create boilerplate folders and files for a project.
You will need to execute one command per model:
rails g model Order
rails g model Customer
The model
generator is defined like this:
Unfortunately, you will have to settle for:
rails g model Order
rails g model Customer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With