diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-08-29 00:56:49 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-08-29 00:56:49 +0300 |
commit | f2a43ff5b7eec188ffc470649bf40d268cbdce2a (patch) | |
tree | f9a59f5d83d883c482c9ebfe811580a0fc8f6be6 /app/controllers/boards/application_controller.rb | |
parent | 5f88660a3f5d9f0de0109a3da46e81ea9024c677 (diff) |
Group boards CE backport
Diffstat (limited to 'app/controllers/boards/application_controller.rb')
-rw-r--r-- | app/controllers/boards/application_controller.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/controllers/boards/application_controller.rb b/app/controllers/boards/application_controller.rb new file mode 100644 index 00000000000..b2675025fc0 --- /dev/null +++ b/app/controllers/boards/application_controller.rb @@ -0,0 +1,21 @@ +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.parent + end + + def record_not_found(exception) + render json: { error: exception.message }, status: :not_found + end + end +end |