/comments.atom: add atom feed for comments.

This commit is contained in:
evazion
2017-05-11 23:52:35 -05:00
parent 78b08d8394
commit e68946e95d
7 changed files with 42 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ class CommentsController < ApplicationController
skip_before_filter :api_check
def index
if params[:group_by] == "comment"
if params[:group_by] == "comment" || request.format == Mime::ATOM
index_by_comment
elsif request.format == Mime::JS
index_for_post
@@ -92,6 +92,10 @@ private
@comments = Comment.search(params[:search]).paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
respond_with(@comments) do |format|
format.html {render :action => "index_by_comment"}
format.atom do
@comments = @comments.includes(:post, :creator).load
render :action => "index"
end
format.xml do
render :xml => @comments.to_xml(:root => "comments")
end