Ruby Build a Rails API Coding the API Returning JSON

Return Json

Let's make sure when we call monkey, we can see all the bananas she has. Change the code below to use as_json to include bananas in the JSON render. Hint: We're only including one thing, so this does not need an array!

monkeys_controller.rb
class MonkeysController < ApplicationController
  before_filter :find_monkey

  def show
    render json: @monkey
  end

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