Ruby / Rails: where is the code for creating forests

I was looking at the code on github.com/rails/rails, and I could not figure out where the code was for creating the Rails scaffolds. Can anyone shed some light on this?

+6
source share
1 answer

https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb

Did you find it? If you track it, resource_generator , you will find the code that creates the route. If you select generator_resource, you will find the model generator, auxiliary generator, etc.

You will not find a single file that generates everything.

If I do not completely understand your question, and you just want to know what this command is, this:

cd your/application/directory 

Rails Version <3.0.0

 script/generate scaffold model_name column_name:column_type 

Rails version> 3.0.0

 rails g scaffold model_name column_name:column_type 
+5
source

Source: https://habr.com/ru/post/894024/


All Articles