fixed co-author relation bug....
This commit is contained in:
1 parent
afd8e7e380
commit
1289ad9f9d
4 files changed
+15
-12
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user