title: Jbuilder Build Multidimensional Array
body: <p>Jbuilder code:</p>
  
  <pre><code>json.array!(@venues) do |venue|
    json.extract! venue, :id, :name, :longitude, :latitude, :price_range, :venue_category_id, :venue_images, :address, :short_description, :max_capacity
  end
  </code></pre>
  
  <p>In my models each 'Venue' has_many 'Venue_Images'. The JSON above is giving me an array of objects for venue_images within the main venues array, as expected.</p>
  
  <p>The venue_image objects are like this:</p>
  
  <pre><code>#&lt;Item:0x007fc97559b960&gt; {
                      :id =&gt; 1,
      :image_content_type =&gt; "image/jpeg",
         :image_file_name =&gt; "chanel.jpg",
         :image_file_size =&gt; 28880,
        :image_updated_at =&gt; 2012-04-09 21:00:08 UTC
  }
  </code></pre>
  
  <p>I need to iterate over the venue images in the jbuilder code somehow so I can call Paperclip/S3 helpers (i.e .image.url(:medium)) on them, as these aren't available in the JS view. I need to get these urls into the @venues array rather than all the other properties of the paperclip object, so I can iterate through them in the JS and display them in my view.</p>
  
  <p>What's the best way to do this? I've tried a few different blocks and looked at the jbuilder wiki and a couple of articles, but can't get anything to work.</p>
  
  <p>Thanks</p>