Take the 2-minute tour ×

I used the following method to generate scaffold for platform list in our app:

rails generate scaffold platform name:string url:string country:string

I would like to still use scaffold possibility to add additional attributes, like type and gender, which should be drop downs, or preferably multi-select's.

Is there a way to use rails generate to create such a models?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You have already generated a scaffold for Platform. So you have two options:

  • edit scaffold by hand to add the new fields (recommended)
  • remove scaffold with rails destroy scaffold and then use rails generate again

Anyway scaffolding doesn't allow you to specify options for a drop-down menu. In any case you have to manually edit the scaffold. Furthermore in Rails migrations you cannot specify ENUM fields, so the best option for gender would be a string field with unitary length (with a validates_inclusion_of in model).

P.S. Don't use type as a column name because you will probably get strange behaviors.

share|improve this answer
add comment

Your Answer


