Just ran into the same thing. In regular Rails, not rails-api. Hope to come up with something better, but so far I just do (as hinted above):
def show
render json: Room.find(params[:id])
rescue ActiveRecord::RecordNotFound
render json: {}, status: :not_found
end
I suppose this is reasonable if you think about Rails' "rescue and return 404 only in production" feature as a convenient default, but when you care more about status codes, you need to get your hands (and code) a bit dirty.