Am having trouble with rake file, but can't find problem. Can you
help? Haven't been able to understand the error message returned.
Thank you.
Am having trouble with rake file, but can't find problem. Can you
help? Haven't been able to understand the error message returned.
Thank you.
Can I see what's in 20091112074628_add_price_to_product.rb ?
It says there's a syntax error in your migration.
Here you go:
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
Here you go:
class AddPriceToProduct < ActiveRecord::Migration
def self.up
add_column :products, :price, :decimal
:precision => 8, :scale => 2, :default => 0
It seems that you have missed a comma after the field type (i.e. decimal) and it should be
implemented as follows:
add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0
Thus, the migration should look as follows:
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
Good luck,
-Conrad
The missing comma was the problem. The migration worked now.
Thank you.
pauld