开发者

Ruby/Rails: where is the code to generate scaffolds

开发者 https://www.devze.com 2023-03-24 01:40 出处:网络
I was browsing the code at github.com/rails/rails, and I couldn\'t figure out where the开发者_开发技巧 code was to generate Rails scaffolds. Can anybody shed some light on this?https://github.com/rail

I was browsing the code at github.com/rails/rails, and I couldn't figure out where the开发者_开发技巧 code was to generate Rails scaffolds. Can anybody shed some light on this?


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

Did you find that? If you track down it's require, resource_generator, you'll find the code that creates the route. If you track down the resource_generator's requires, you'll find the model generator, helper generator, etc.

You won't find any single file that generates everything.

If I totally misunderstood your question and you just want to know what the command is, it's:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号