0
votes

I jus created a rails application. I created a model using

 ruby script/generate model Article

next i edited the my 001_create_articles.rb file by adding these lines in self.up method

 def self.up
    create_table :articles do |t|
        t.string :title
        t.text :body
        t.string :published_at

    t.timestamps
end

end

Now i ran
rake db:migrate 
. But migrate does not work, it simply does no print anything. Anyone knows where i am going wrong?
2
did you bundle your db gems + edit your database.yml?apneadiving
yes i edited my database.yml file and i am sure about the parameters in development section. But wat s bundling gems. sorry am new to railsCHID
If you're new to rails, I'd recommend you to use rails3 and go straight to railsforzombies.org, you'll learn a lot there.apneadiving
What Rails version are you running?Heikki
i am running rails 2.0.2CHID

2 Answers

0
votes

Are you missing one end from your up method?

def self.up
  create_table :articles do |t|
    t.string :title
    t.text :body
    t.string :published_at
    t.timestamps
  end
end
0
votes

I think you have to generate a migration. If i understood it right, you added the migration code to the model.

You have to run something like that:

ruby script/generate migration articles

After that open the generated file and add your code there. Hope it helps