Skip to content

Commit 5a094c2

Browse files
sanakdkastl
authored andcommitted
Fix issues/users index/show api to return json object correctly
1 parent 845f096 commit 5a094c2

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

app/views/issues/index.api.rsb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ api.array :issues, api_meta(:total_count => @issue_count, :offset => @offset, :l
2121
api.estimated_hours issue.estimated_hours
2222

2323
if issue.geom
24-
api.geojson issue.geojson.to_json
24+
api.geojson (params[:format] == "json") ? issue.geojson : issue.geojson.to_json
2525
else
26-
api.geojson ""
26+
api.geojson nil
2727
end
2828

2929
if issue.distance

app/views/issues/show.api.rsb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ api.issue do
2424
end
2525

2626
if @issue.geom
27-
api.geojson @issue.geojson
27+
api.geojson (params[:format] == "json") ? @issue.geojson : @issue.geojson.to_json
2828
else
2929
api.geojson ""
3030
end

app/views/users/index.api.rsb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ api.array :users, api_meta(:total_count => @user_count, :offset => @offset, :lim
1010
api.last_login_on user.last_login_on
1111

1212
if user.geom
13-
api.geojson user.geojson
13+
api.geojson (params[:format] == "json") ? user.geojson : user.geojson.to_json
1414
else
15-
api.geojson ""
15+
api.geojson nil
1616
end
1717

1818
render_api_custom_values user.visible_custom_field_values, api

app/views/users/show.api.rsb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ api.user do
1010
api.status @user.status if User.current.admin?
1111

1212
if @user.geom
13-
api.geojson @user.geojson
13+
api.geojson (params[:format] == "json") ? @user.geojson : @user.geojson.to_json
1414
else
15-
api.geojson ""
15+
api.geojson nil
1616
end
1717

1818
render_api_custom_values @user.visible_custom_field_values, api

0 commit comments

Comments
 (0)