attchments=Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
attchments=Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_id in (#{user_course_ids.empty??'0':user_course_ids.join(',')}) and container_type = 'Course')"+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty??'0':user_course_ids.join(',')})