comment policy and test updates
This commit is contained in:
@ -15,12 +15,10 @@ module Admin
|
||||
end
|
||||
|
||||
def create
|
||||
authorize QuizComment
|
||||
comment = QuizComment.create(
|
||||
comment_params.merge(user_id: current_user.id, test_hash: params[:test_hash])
|
||||
)
|
||||
comment = QuizComment.new(comment_params.merge(user_id: current_user.id, test_hash: params[:test_hash]))
|
||||
authorize comment
|
||||
|
||||
flash_message = if comment.persisted?
|
||||
flash_message = if comment.save
|
||||
{ success: "Sucessfully created comment" }
|
||||
else
|
||||
{ error: "Failed to save comment" }
|
||||
|
Reference in New Issue
Block a user