edit coauthor relation done

This commit is contained in:
harrybomrah authored and chris committed 2012-12-06 07:59:44 +08:00
1 parent 4681f0ee36
commit 3d1fb48489
5 files changed
+33 -9

No files matched your search

@@ -25,7 +25,7 @@ class Desktop::CoAuthorRelationsController < ApplicationController
if @co_author_relation.save
newv = render_to_string partial: "show_form", object: @co_author_relations
render json: {success: true, msg: "New Relation successfully saved!", newvalue: newv}.to_json
render json: {success: true, msg: "New Relation successfully saved!", newvalue: newvm}.to_json
else
error_msg = @co_author_relation.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
@@ -34,9 +34,10 @@ class Desktop::CoAuthorRelationsController < ApplicationController
def update
@co_author_relation = CoAuthorRelation.find(params[:id])
if @co_author_relation.update_attributes(params[:co_author_relation])
render json: {success:true, msg: t('update.sucess.co_author')}.to_json
@co_author_relations = CoAuthorRelation.all
newv = render_to_string partial: "show_form", object: @co_author_relations
render json: {success: true, msg: "New Relation successfully updated!", newvalue: newv}.to_json
else
error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json