Rails Fundamentals - Create a Model

This topic is for the Create a Model exercise in the Rails Fundamentals trail. Post any questions, corrections, or pointers you have to share with other Upcase subscribers.

What version of ruby should I be using? Getting errors running rspec and rake.

kernel_require.rb:54:in `require’: cannot load such file – rails_helper (LoadError)

Hello @stjohn714, the expected ruby version is 2.2.1. There is a .ruby-version file in the repo that specifies the ruby version (and should be picked up if you are using any of RVM, rbenv, or chruby). Have you tried running rspec with bundle exec rspec?

Hi :slight_smile: I am running the rake task for this step/repo and getting an error because the model is not generated yet - starting out the project. I know that this model will exist when I generate it, but I am unsure if it is the expected behaviour that there is an error, rather than a failing spec. I’ll move ahead in the meantime. Thanks - update feels like a very good investment!

Hi @Ivor, the error is expected. Often when you are TDDing you’ll start with a test that expects a model or controller to exist and thus you’ll get an error. In true TDD you would then create the model (but only create) and re-run the tests to see the next error / failure.