Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding more fields to an existing model

Let's say I have done this:

rails generate model User name:string   email: string

and also have done this:

bundle exec rake db:migrate

and now I decide to add a third field like address to the User model. How should I do that?

like image 509
Bohn Avatar asked Jan 17 '13 03:01

Bohn


1 Answers

You can do this:

  rails g migration AddAddressToUser address:string
  rake db:migrate
like image 96
Rahul Tapali Avatar answered Sep 28 '22 07:09

Rahul Tapali