summaryrefslogtreecommitdiff
path: root/app/controllers/forumgroups_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/forumgroups_controller.rb')
-rw-r--r--app/controllers/forumgroups_controller.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/forumgroups_controller.rb b/app/controllers/forumgroups_controller.rb
index a7b31ab..2344602 100644
--- a/app/controllers/forumgroups_controller.rb
+++ b/app/controllers/forumgroups_controller.rb
@@ -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 \ No newline at end of file
+end