0

I am following a tutorial, but this tutorial is using Rails 2.0. However, I am using Rails 4.0. I guess this difference makes a trouble when doing rake migrate?

[photos/db/migrate/20130722034245_create_photos.rb]

class CreatePhotos < ActiveRecord::Migration
def change
  create_table :photos do |t|

    t.timestamps
  end
end

def self.up
  create_table :photos do |photo|
    photo.column "filename", :string
  end
end

def self.down
    drop_table :photos
  end
end

[On my terminal]

seodongju@Seoui-MacBook-Pro ~/Desktop/Projects/photos$ rake migrate
rake aborted!
Don't know how to build task 'migrate'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)
4

2 回答 2

1
 rake db:migrate

不是

 rake migrate.
于 2013-07-22T04:10:59.570 回答
1

请做

rake db:migrate

而不仅仅是rake migrate. 还可以查看以下链接中标题Running Migrations下的文档:http: //guides.rubyonrails.org/migrations.html

于 2013-07-22T04:10:59.807 回答