Migration error

Run it to generate a new migration
1)rails generate migration add_price_to_product price:decimal

2)Added following to migration file

class AddPriceToProduct < ActiveRecord::Migration
def self.up
add_column :products, :price, :decimal,
:precision => 8, :scale => 2, :default => 0
end
def self.down
remove_column :products, :price
end
end
rake db:migrate
Then ran “rake
db:migrate”,it created a new columns in table products with name
“price” ,but i didnt change the view(didnt create a filed with name
“price”)

Why

Thanks

amritpal p. wrote in post #995532:

                                          Then ran "rake

db:migrate",it created a new columns in table products with name
“price” ,but i didnt change the view(didnt create a filed with name
“price”)

Migrations don’t do that (you can create migrations to do all sorts of
things, not necessarily related to new fields for a view).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs