class AudiencesController < ApplicationController
  def show
    @guides = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
    render :json => @guides.collect do |g|
      {
        :title => g.title,
        :tags => g.tags,
        :url => admin_guide_url(g)
      }
    end
  end
end

class AudiencesController < ApplicationController
  def show
    publications = Publication.any_in(audiences: [params[:id]]).collect(&:published_edition).compact
    details = publications.to_a.collect do |g|
      {
        :title => g.title,
        :tags => g.container.tags,
        :url => guide_url(:id => g.container.slug, :format => :json)
      }
    end
      
    render :json => details
  end
end

Extend audiences API code to better include transactions
Extend audiences API code to better include transactions
