summaryrefslogtreecommitdiff
path: root/app/controllers/boards/application_controller.rb
blob: 15ef6698472effef893861c90ef035cbdebc1449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Boards
  class ApplicationController < ::ApplicationController
    respond_to :json

    rescue_from ActiveRecord::RecordNotFound, with: :record_not_found

    private

    def board
      @board ||= Board.find(params[:board_id])
    end

    def board_parent
      @board_parent ||= board.resource_parent
    end

    def record_not_found(exception)
      render json: { error: exception.message }, status: :not_found
    end
  end
end