开发者

rake does not returning anything

开发者 https://www.devze.com 2023-02-02 21:40 出处:网络
I jus created a rails application. I created a model usingruby script/generate model Article next i edited the my 001_create_articles.rb file by adding开发者_开发百科 these lines in self.up method

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?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消