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 Build a Rails API Coding the API Returning JSON

Challenge missing API reference to `as_json`; important since it's not discovered in the videos leading to it

In the "Returning JSON" challenge immediately after the Better JSON Messages, it's missing providing students references to how as_json

Unless you're familiar with Rails APIs concerning returning JSON in controllers, it's currently unnecessarily difficult for students completely unfamiliar with generating Rails API to pass this challenge without a reference to as_json API, particularly its parameters.

Unless Naomi Freeman differs, it seems the challenge is best appended to include documentation or provide a few examples for course takers completely unfamiliar with designing APIs using Rails to complete the challenge.

It'd also be a good opportunity for students to get used to the docs—Rails having one of the most newbie-friendly documentation on the internet.

class MonkeysController < ApplicationController
  before_filter :find_monkey

  def show
    render json: @monkey.as_json(include: :bananas)

  def find_monkey
    @monkey = Monkey.find(params[:id])

Edit: Treehouse's modal system seemingly didn't understand how to scrape my answer properly that's the definitive answer to the challenge based on a priori knowledge of Rails controllers and the challenge accepting it

2 Answers

I'm aware of that, but it's much later in the course; I've made an issue directly to the Challenges support team since essentially the beginning of the class for reordering to be done; I wasn't aware there were forum issues also relevant to it already.

Jessica H
Jessica H
16,612 Points

Actually Kevin its aright for you to be unaware.

I noticed the past couple of days that the forum isn't updating correctly after a refresh or when rendering the page from another location. Had it been updating properly, I would have checked other topics before I posted my question about as_json...

Then you guys started talking about how this forum was over run with 'tons of api-question overload.'

I was a bit bewildered because I didn't see any topics at all about the issue.

Only yesterday did I see what you were seeing.

The forum seems to be stuck on some topics from days ago, or it will set me back half a day, because I notice that my points are suddenly substantially lower whenever I enter the ruby forum. lol. I have to refresh several times before it updates, and even if I clear my cache..

Interesting, I'll notify Treehouse's support staff about looking more into this when I next get the chance to.