Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are the docs for Rails "script/generate model"?

Tags:

I am running

ruby script/generate scaffold 

or

ruby script/generate model 

and I know the basic syntax, like

ruby script/generate scaffold Dude name:string face:boolean 

but I do not know things like:

  • should names of variables have underscores or be camelCased?
  • what kind of variable types are acceptable?

Where can I find such information?

like image 461
Dan Rosenstark Avatar asked Feb 05 '09 01:02

Dan Rosenstark


1 Answers

Type the command without arguments and the documentation is revealed:

$ script/generate model 

You can use either camelcase or underscores for the model name.

  • Model names are singular; controller names are plural.
  • Field names use underscores.

I can't remember all the possible field types, I just look them up from the Migration docs, as linked above.

like image 62
Andrew Vit Avatar answered Oct 03 '22 19:10

Andrew Vit