class CreaturesController < ApplicationController SHOWABLE_ATTRIBUTES = [:id, :name, :health_points] def show @creature = Creature.find(params[:id]) render json: @creature.as_json(only: SHOWABLE_ATTRIBUTES) rescue ActiveRecord::RecordNotFound render json: {}, status: 404 end end