Added more json support

This commit is contained in:
MrYummy
2017-07-01 04:44:00 +02:00
parent 0972181e75
commit 361b15e398
4 changed files with 41 additions and 6 deletions

View File

@@ -5,7 +5,12 @@ class ForumgroupsController < ApplicationController
end
def show
redirect_to forums_path + "#group-#{params[:id].to_i}"
if request.format.html?
redirect_to forums_path + "#group-#{params[:id].to_i}"
else
fg = Forumgroup.find_by(id: params[:id])
respond_to {|format| format.json {render json: (fg.attributes.to_json if fg.try(:can_read?, :current_user))}}
end
end
def edit
@@ -77,4 +82,4 @@ class ForumgroupsController < ApplicationController
params.require(:forumgroup).permit(a)
end
end
end