make coauthor relation can be edit

This commit is contained in:
Rueshyna committed 2012-12-05 17:49:41 +08:00
1 parent 3e9cf27fe2
commit abbe1e86ac
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