开发者

How do I load and use Michael Hartl's completed Rails Tutorial files?

I know the answer is simple, but I've downloaded Michael's Hartl's completed files for his rails tutorial from Github. But now that I have it, how do I run it?

I'm ru开发者_Python百科nning rspec spec/ and basically I've failed all 158 tests and they all look something like this

Failure/Error: user = Factory(:user)
  ActiveRecord::StatementInvalid:
   Could not find table 'users'

I've ran

$ bundle install

as well as

$ rake db:reset
$ rake db:migrate

since it looks like it has something to do with the database.

Thanks!


Try running rake db:test:prepare


I believe that you're still going to have to create a local mysql database, along with a user with full privileges to create tables within it, and configure the app to point to it.

You may also need to make sure you have some other local bits installed, that the gems rely upon. When I went through it, I followed the instructions to install various testing utilities and such that gem cannot install on its own. I'm not sure if it actually depends upon any of those, but they sure are awesome and helpful.


Rails applications are typically configured to run in one of several modes: development, production, or test. Take a look at your database.yml file, and you'll likely see what database each environment points to. When you simply run "rake db:migrate" at the command prompt, you are almost certainly migrating your development database. Your tests, on the other hand, should be running in your clean test database.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜