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 Build a Rails API Namespacing Routes and JSON Add a Namespace

Add a namespace in Rails API

Challenge Task:

Change the below routes file to include a gone_bananas namespace. Hint: Make sure you have both resources for the API and resources for your application!

I think I'm doing this according to the video by namespacing a :gone_bananas route, adding resources :monkeys, and keeping resources :monkeys outside of the namespace route. However, I'm getting "Bummer! Try Again!". Anybody know what I'm doing wrong here?

routes.rb
Rails.application.routes.draw do
  namespace :gone_bananas do
    resources :monkeys
  end
  resources :monkeys
end
Jay McGavren
Jay McGavren
Treehouse Teacher

Apologies for the difficulties with this challenge, folks. It was indeed an internal error. We believe we have it fixed now. Please let us know if you have further trouble!

Kyle Robertson
Kyle Robertson
31,600 Points

Thanks Jay, I'm still getting an error saying it's incorrect when listing resources :monkeys in both the namespace and the application.

And it still says correct but an internal server error when listing it in just the namespace.

Kenan Memis
Kenan Memis
47,314 Points

Nop.. the above code still not working :(

Jay McGavren
Jay McGavren
Treehouse Teacher

The challenge is checking to ensure that the :monkeys resource route appears within the :gone_bananas namespace, and only within the :gone_bananas namespace... The above code should be failing with the error: "You need to wrap the 'monkeys' route in a 'gone_bananas' namespace."

This answer should pass:

Rails.application.routes.draw do
  namespace :gone_bananas do
    resources :monkeys
  end
end
Kyle Robertson
Kyle Robertson
31,600 Points

It passes, but then the "Oh no, something's gone wrong.... Contact support" window pops up.

Jay McGavren
Jay McGavren
Treehouse Teacher

Kyle Robertson Does it do so even after reloading the page?

Also, there does definitely seem to be a conflict between the question and the expected answer. I'm going to seek clarification from the teacher and get either the hint or the test updated.

Kyle Robertson
Kyle Robertson
31,600 Points

Yes on both refresh and running a new session, the same error pops up.

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

OK, the question is updated and clear, it passes (just without this last resources monkeys line in the global scope), but as other students reported, it throws a popup window with "Oh no!", doesn't update the status of the challenge and the challenge is still grey on the list of things to do in that section ;)

Kyle Robertson
Kyle Robertson
31,600 Points

Is anyone having the same issue with later code challenges in this course? I'm getting the same error with the next one as well.

Jay McGavren
Jay McGavren
Treehouse Teacher

It appears the "Internal Server Error" issue is entirely separate from the original problem with this challenge. Only certain users are affected, and only for this course. We've just finished a fix and are working on getting it deployed. We'll post again when that's done.

Jay McGavren
Jay McGavren
Treehouse Teacher

Fix is deployed. Videos, quizzes, and code challenges for this course should now appear checked off when complete. Please contact support if you need any further help. Sorry for the trouble!

12 Answers

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

I already contacted the Support with this, hope they'll fix it soon. Your code should definitely pass.

I am also having trouble with this.

Hopefully they fix it eventually.

David Curtis
David Curtis
11,301 Points

Glad I am not the only one!

Maciej Czuchnowski
Maciej Czuchnowski
36,440 Points

Still not working. I wonder if there's something wrong with the challenge evaluator or if the question was supposed to be something else.

Kenan Memis
Kenan Memis
47,314 Points

In preview under output.html there is this code initially:

b0bbc726-e841-40fe-8ac1-7f9dc27ff47e.rb:8:in `anonymous': undefined local variable or method `context' for main:Object (NameError) from b0bbc726-e841-40fe-8ac1-7f9dc27ff47e.rb:12:in `eval' from b0bbc726-e841-40fe-8ac1-7f9dc27ff47e.rb:12:in `
Kyle Robertson
Kyle Robertson
31,600 Points

seems to work now if you just wrap the resources :monkeys inside the namespace and leave it out of the application level.

Rails.application.routes.draw do
  namespace :gone_bananas do
    resources :monkeys
  end
end
Kenan Memis
Kenan Memis
47,314 Points

It gives an internal error and seems to passed the challenge but it is not. And also this is not the true case.. They have to correct it. Support team where are you :)

Kyle Robertson
Kyle Robertson
31,600 Points

Ah you're right. I spoke too soon.

Kenan and Kyle are right!

I also got "Challenge Completed", but then it pops up:

Oh no!

Internal Server Error

If you continue experiencing problems, please contact support at help@teamtreehouse.com.

..and I still didn't credit for completing the challenge.

Maybe I should get credit for QA/troubleshooting?

Everyone who has had to deal with this should get bonus points!

Elliott Roche
Elliott Roche
12,096 Points

I've got the same Internal Server Error problem even after passing all of the challenges successfully.

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

Apologies to the folks encountering the Internal Server Error issue - we're looking into it and will post as soon as we have a fix.

Kyle Robertson
Kyle Robertson
31,600 Points

Thanks Jay, it happens on all the quizzes and code challenges after this one as well, and videos aren't marked as complete on my end after being watched.