Abramodj
Abramodj

Reputation: 5879

Edit a Rails scaffold class to add a new field

I've generated a simple Rails 3 class using the scaffold function:

rails generate scaffold Fattura data:date importo:integer descrizione:text

Now I need to add another field in the class Fattura. What is the best way to do that?

Upvotes: 6

Views: 6289

Answers (1)

zetetic
zetetic

Reputation: 47548

You can create a migration which adds a column:

rails generate migration add_my_column_to_fattura my_column:string
rake db:migrate

Upvotes: 7

Related Questions