make coauthor relation can be edit

This commit is contained in:
Rueshyna authored and chris committed 2012-12-06 07:59:43 +08:00
1 parent 8d110cce91
commit e7fdac1d23
8 files changed
+27 -7

No files matched your search

@@ -8,6 +8,10 @@ class Desktop::CoAuthorRelationsController < ApplicationController
end
end
def edit
@co_author_relation = CoAuthorRelation.find(params[:id])
end
def new
@new_relation = CoAuthorRelation.new
end
@@ -25,6 +29,17 @@ class Desktop::CoAuthorRelationsController < ApplicationController
end
end
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
else
error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@co_author_relation = CoAuthorRelation.find(params[:id])
@co_author_relation.destroy