I\'ve obtained a project that have controllers (minimal code only) and models, but the views are missing. Is there a way to generate the views only using scaffold or another
This is what the scaffold generator calls internally:
rails g erb:scaffold User
erb
is the templating engine used, so you can also use haml:scaffold
.
You must explicitly specify the fields you would like the scaffolding to use--rails does not automatically deduce them from the created model. For example:
rails g erb:scaffold User firstname lastname reputation
See rails g --help
for options like skipping, forcing overwriting, and dry runs or generate scaffold --help
for information specific to generating scaffolding.