What type of functionalities do the different generators generate in Rails?

Hey folks,

*So I’m quite the newbie here as y’all can tell. *
*Prior to asking this question as referenced in subject, I read the guide at http://guides.rubyonrails.org/command_line.html#rails-generate but was not able to find the answer to my question, in spite of then trying to search for more online resources. *
What I’m wondering is, if there’s a way for me for e.g. to type some command within the Mac’s terminal to output functionalities that all generators generate (for e.g. scaffold would generate CRUD functionality, and controller would generate pages functionality, etc)?

Objective: to know which generator to use, to generate desired features of any app

Much thanks

Hey, Songs. Welcome to the group discussion.

I’m not sure I really understood what you’re asking though. :confused:

output functionalities that all generators generate

If you want to see the list of possible generate commands, you can run rails generate in the terminal. For more information about a particular generator, you can append --help (e.g. rails generate migration --help). I don’t know if that’s what you’re looking for because you mentioned to having read the Rails Guides. If you don’t really know what each of them really do, as a beginner, I recommend you to read the details for at least migration and scaffold. As your expertise grows, you may eventually find yourself depending less on the use of scaffolding.

Try some of the generators yourself. You can always undo the generated files by running the same command, but using destroy instead of generate (e.g. rails destroy model post).

If you run

$ rails generate --help

it will list out all of the generators built in to rails. To learn what any individual generator does, type

$ rails generate --help

for example:

$ rails generate scaffold --help

Running via Spring preloader in process 12695


rails generate scaffold NAME [field[:type][:index] field[:type][:index]] [options]

Running a generator with -p will have it show you what it would do, without making actually making any changes, e.g.,