app/controllers/v1/answers_controller.rb
# Only enble authors to edit or delete questions
Only enble authors to edit or delete questions
Only enble authors to edit or delete questions
def author_verification (current_user, answer, action)
        unless current_user.id == answer.created_by.to_i
          return
        end
        if action == "update"
          answer.update(answer_params)
        else
          answer.destroy
        end
      end
def author_verification ( current_user , answer , action ) unless current_user . id == answer . created_by . to_i return end if action == "update" answer . update ( answer_params ) else answer . destroy end end
Only enble authors to edit or delete questions
Only enble authors to edit or delete questions
current_user
answer
action