Ruby Active Record Associations in Rails Using Associations in Your App Nested Routes and Resources

I'm not sure why I'm getting an error here.

But it tells me the rails module doesn't exist?

config/routes.rb
Rails.application.routes do
  # YOUR CODE HERE
  resources :owners do
    resources :pets
  end
end

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

Hi, Kristina Ivanova ,

Sorry you've had trouble with the challenge! It looks like the "Rails is not a module" error was due to some changes that got made on the challenge runner back end, which broke the challenge. That should be fixed now.

There's also a separate issue in your code: you actually need to call Rails.application.routes.draw, not just Rails.application.routes. This portion of your code:

  resources :owners do
    resources :pets
  end

...will pass the challenge if you leave the pre-set code alone and just insert that.

Sorry again for the "Rails is not a module" error! I've tested the other challenges for the course and confirmed they are working correctly, but if you have any further trouble please let us know!