AgostinoX
AgostinoX

Reputation: 7683

rails generate scaffold with --migration=false

I have a very large model (say 200 fields), so it isn't very convenient to write them down into the command line.
So I first generate the migration then i did scaffold with:

rails generate scaffold myModel --migrate=false

It generated the controller with its actions, it updated the routes.rb and created views/myModel. But it didn't add the fields to the views. Isn't scaffold supposed to provide a basic field presentation? If not, is there a way to provide it?

Upvotes: 1

Views: 573

Answers (1)

olleicua
olleicua

Reputation: 2118

Scaffold uses the command line arguments you specify to create the relevant files. If you don't specify any fields at the command line then it can't add them to the views (because it doesn't know them). The Scaffold command is a one time thing. You might consider typing out and/or programmatically creating the relevant scaffold command in a text editor and pasting it into the console.

Upvotes: 1

Related Questions