Reputation: 1643
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_atNow i rant.timestamps end
end
rake db:migrate. But migrate does not work, it simply does no print anything. Anyone knows where i am going wrong?
Upvotes: 0
Views: 235
Reputation: 20724
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
Upvotes: 0
Reputation: 15417
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
Upvotes: 0