Improve Post component

This commit is contained in:
riggraz
2019-09-12 18:03:19 +02:00
parent f599471af1
commit e649588211
11 changed files with 50 additions and 36 deletions

View File

@@ -39,8 +39,9 @@ class PostsController < ApplicationController
def update
post = Post.find(params[:id])
if current_user.role == :user && current_user.id != post.user_id
if current_user.role == 'user' && current_user.id != post.user_id
render json: I18n.t('errors.unauthorized'), status: :unauthorized
return
end
post.post_status_id = params[:post][:post_status_id]