title: What is the best way to return multiple variables and arrays formatted in xml, json etc with respond_with
body: <p>I'm looking for a good way to return xml or json from a controller <em>including</em> multiple variables. For example:</p>
  
  <pre><code>def index
      @ad = Ad.some_annoying_ad
      @map = Map.some_map_for_something
      @articles = Articles.trending
  
      respond_with @articles
  end
  </code></pre>
  
  <p>How would I best add the @ad and @map var to the @articles array? I have seen people using the merge function, but I am not sure if that's what I'm looking for. Just want to know which way is most standard, flexible, DRY. Thanks!</p>
  
  <p>Note: I am aware that respond with will automatically format the results in xml or json depending on the file extension added to the url. Thanks!</p>