Ok, going through the book Ruby on Rails Made Easy, and I made a mistake here. I forgot to add in two columns into my table. so i tried to add them back into the migration file and run it again, but after checking with the #ROR channel on IRC i was informed that this is not possible. I needed to make a new migration file.
I have done this, but I am obviously doing something wrong. If someone could point out my error it would be appreciated.
Original migration file.
class CreateCategories < ActiveRecord::Migration def self.up create_table :categories do |t| t.column :name, :string end
Category.create :name => "Furniture" Category.create :name => "Miscellaneous"
add_column :classifieds, :category_id, :integer Classified.find(:all).each do |c| c.update_attribute(:category_id, 4) end end
def self.down drop_table :categories remove_column :classifieds, :category_id end end
Migration file I tried to create.
class AddColumns < ActiveRecord::Migration def self.up create_t.column :name, :string end
Category.create :name => "Electronics" Category.create :name => "Real Estate" end
def self.down drop_table :categories remove_column :classifieds, :category_id end end
receive an unexpected kEND expecting $ error when trying to run rake db:migrate on the new file.
Thank you,
Dave