set user_type correct for comments

This commit is contained in:
Ralf Teusner
2015-04-27 17:59:28 +02:00
parent 725fd00256
commit 0447b076c6
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ class CommentsController < ApplicationController
# POST /comments
# POST /comments.json
def create
@comment = Comment.new(comment_params.merge(user_type: 'InternalUser'))
@comment = Comment.new(comment_params.merge(user_type: current_user.class.name))
respond_to do |format|
if @comment.save

View File

@ -28,7 +28,7 @@ class SubmissionsController < ApplicationController
# copy each annotation and set the target_file.id
unless(params[:annotations_arr].nil?)
params[:annotations_arr].each do | annotation |
comment = Comment.new(:user_id => annotation[1][:user_id], :file_id => annotation[1][:file_id], :user_type => current_user.user_type, :row => annotation[1][:row], :column => annotation[1][:column], :text => annotation[1][:text])
comment = Comment.new(:user_id => annotation[1][:user_id], :file_id => annotation[1][:file_id], :user_type => current_user.class.name, :row => annotation[1][:row], :column => annotation[1][:column], :text => annotation[1][:text])
source_file = CodeOcean::File.find(annotation[1][:file_id])
#comment = Comment.new(annotation[1].permit(:user_id, :file_id, :user_type, :row, :column, :text, :created_at, :updated_at))