From 9347f270596743e5799136a62d8c9206df55ffc6 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 26 Dec 2016 18:25:31 -0600 Subject: [PATCH] /comments.json: add id param; allow id and post_id to take lists of ids. --- app/models/comment.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 2f909b3b0..7e3d466c5 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -69,8 +69,12 @@ class Comment < ActiveRecord::Base q = q.body_matches(params[:body_matches]) end + if params[:id].present? + q = q.where("id in (?)", params[:id].split(",").map(&:to_i)) + end + if params[:post_id].present? - q = q.where("post_id = ?", params[:post_id].to_i) + q = q.where("post_id in (?)", params[:post_id].split(",").map(&:to_i)) end if params[:post_tags_match].present?