views:

36

answers:

1

I have developed a web application with fields Keyword,Latitude and Longitude. I want to add one more field called Radius to the web application.. How should i proceed.

Waiting for the reply,

Thanks in advance

+3  A: 

really simple to do it. Simply do:

script/generate migration AddRadiusToAddress Radius:string

The example above supposed your model is called address, hence the "AddRadiusToAddress", but if your model is called something else, simply change address with that "something else"

And the field name in this case is radius, and I;m setting iut to be string, you might wanna change this as well.

After that, simply rung:

rake db:migrate

Hope this helps you.

UPDATE

And just for the sake of it, I thought I'd add an example of removing a field as well:

script/generate migration RemoveRadiusFromAddress role:string
Marcos Placona
Don't forget that if you're using scaffolding or similar UI for setting these fields, you'll need to edit those UI pages (or anything else that sets/gets these fields), and if you need validation on this field, you have to go set that in the model - the steps above create the rows in the database and makes sure the model can access them, but doesn't change any other code.
scottru
Thank you very much.. It helped...:)
Lata Patil