Commit 847eda33 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Add board_path to create/update response

parent ca171eed
......@@ -15,7 +15,8 @@ module EE
respond_to do |format|
format.json do
if board.valid?
render json: serialize_as_json(board)
extra_json = { board_path: board_path(board) }
render json: serialize_as_json(board).merge(extra_json)
else
render json: board.errors, status: :unprocessable_entity
end
......@@ -31,7 +32,8 @@ module EE
respond_to do |format|
format.json do
if @board.valid?
render json: serialize_as_json(@board)
extra_json = { board_path: board_path(@board) }
render json: serialize_as_json(@board).merge(extra_json)
else
render json: @board.errors, status: :unprocessable_entity
end
......@@ -75,6 +77,14 @@ module EE
end
end
def board_path(board)
if @group
group_board_path(parent, board)
else
project_board_path(parent, board)
end
end
def serialize_as_json(resource)
resource.as_json(
only: [:id, :name],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment