parent
9115054b19
commit
7c3e5d79bb
@ -0,0 +1,10 @@
|
||||
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
|
Loading…
Reference in new issue