Ruby Build a Rails API Coding the API Returning JSON

error for as_json. this should be the answer, but i'm getting the "bummer"

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

monkeys_controller.rb
class MonkeysController < ApplicationController
  before_filter :find_monkey

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

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

2 Answers

Damian Kosowski
Damian Kosowski
19,746 Points

It seems you have the colons too close together (include::bananas) should be (include: :bananas)

thank you!