Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!