diff --git a/app/controllers/desktop/co_author_relations_controller.rb b/app/controllers/desktop/co_author_relations_controller.rb index edeeacb8..787ad36c 100644 --- a/app/controllers/desktop/co_author_relations_controller.rb +++ b/app/controllers/desktop/co_author_relations_controller.rb @@ -27,8 +27,17 @@ class Desktop::CoAuthorRelationsController < ApplicationController def destroy @co_author_relation = CoAuthorRelation.find(params[:id]) @co_author_relation.destroy - #reset_co_author_relation @co_author_relation + reset_co_author_relation render :json => {success: true, msg: "deleted successfully!"} end + + private + + def reset_co_author_relation + co_author = CoAuthor.where(co_author_relations_id: @co_author_relation.id) + co_author.map do |c| + c.update_attributes(co_author_relations_id: nil) + end + end end diff --git a/app/helpers/desktop/co_author_relations_helper.rb b/app/helpers/desktop/co_author_relations_helper.rb index 7de13211..fa03bbae 100644 --- a/app/helpers/desktop/co_author_relations_helper.rb +++ b/app/helpers/desktop/co_author_relations_helper.rb @@ -1,8 +1,2 @@ module Desktop::CoAuthorRelationsHelper - def reset_co_author_relation relation - co_author = CoAuthor.where(co_author_relations_id: relation) - co_author.map do |c| - co_author.update_attributes(co_author_relations_id: nil) - end - end end diff --git a/app/views/desktop/co_author_relations/_show_form.html.erb b/app/views/desktop/co_author_relations/_show_form.html.erb index 28ded992..bdb9f72e 100644 --- a/app/views/desktop/co_author_relations/_show_form.html.erb +++ b/app/views/desktop/co_author_relations/_show_form.html.erb @@ -1,6 +1,4 @@ -<%# @co_author_relations.each do |co_author_relation| %>