add back buton in relation page

This commit is contained in:
Rueshyna authored and chris committed 2012-12-06 07:59:44 +08:00
1 parent b4a99e58cf
commit 6d08ca996f
3 files changed
+8 -5

No files matched your search

@@ -16,18 +16,18 @@ class Desktop::CoAuthorRelationsController < ApplicationController
end
def new
@new_relation = CoAuthorRelation.new
@co_author_relation = CoAuthorRelation.new
end
def create
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
@co_author_relation = CoAuthorRelation.new(params[:co_author_relation])
@co_author_relations = CoAuthorRelation.all
if @new_relation.save
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
else
error_msg = @new_relation.errors.full_messages.join("<br />")
error_msg = @co_author_relation.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end