Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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!