Files
national-parks-api/app/controllers/api/v1/parks/base_controller.rb

13 lines
243 B
Ruby

module Api::V1::Parks
class BaseController < ApplicationController
before_action :set_park
private
def set_park
@park = Park.find_by(code: params[:park_code])
head :not_found unless @park.present?
end
end
end