OK, I''ve created the following migration
class CreateProducts < ActiveRecord::Migration
def self.up
create_table :products do |t|
t.column :title, :string
t.column :description, :text
t.column :image_url, :string
end
end
def self.down
drop_table :products
end
end
This has created a table no problem. I''ve then added another column
using the following
ruby script/generate migration add_price
This has worked.
class AddPrice < 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
After creating the 002 migration file above and running rake db:migrate
I get a rake aborted message which says:
You have a nil object when you didn''t expect it
You might have expected an instance of array
The error occured while evaluating nil.
WTF?? Help!!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---