add co-author json

This commit is contained in:
Rueshyna committed 2012-11-23 10:44:48 +08:00
1 parent 9189ebffee
commit 996a69f595
3 files changed
+28 -12

No files matched your search

@@ -62,4 +62,18 @@ class Desktop::CoAuthorsController < ApplicationController
format.json { head :no_content }
end
end
def get_co_authors_json
@co_authors = CoAuthor.where(name_id: current_user.id)
data = Array.new
@co_authors.each do |co_author|
data << {
author: co_author.co_author,
email: co_author.email,
type: co_author.type
}
end
render json: JSON.pretty_generate(data)
end
end