can add relation between co-author
This commit is contained in:
1 parent
5dabfe9319
commit
7822ffc33d
18 files changed
+350
-77
No files matched your search
@@ -0,0 +1,32 @@
|
||||
class Desktop::CoAuthorRelationsController < ApplicationController
|
||||
def index
|
||||
@co_author_relations = CoAuthorRelation.all
|
||||
new
|
||||
|
||||
respond_to do |format|
|
||||
format.html {render layout: false }
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@new_relation = CoAuthorRelation.new
|
||||
end
|
||||
|
||||
def create
|
||||
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
|
||||
|
||||
if @new_relation.save
|
||||
render json: {success:true, msg: "New Relation successfully saved!"}.to_json
|
||||
else
|
||||
error_msg = @new_relation.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
|
||||
|
||||
render :json => {success: true, msg: "deleted successfully!"}
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user