Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 963
Abramodj Avatar asked Mar 06 '11 20:03

Abramodj


People also ask

What is scaffold command?

Scaffolding is a quick way to produce some major pieces of an application. For auto generating a set of models, views and controllers for a new resource in a single operation, scaffolding is used.


1 Answers

You can create a migration which adds a column:

rails generate migration add_my_column_to_fattura my_column:string
rake db:migrate
like image 143
zetetic Avatar answered Oct 03 '22 10:10

zetetic