title: Generate dynamic hstore key calls in Prawn
body: <p>I have an hstore column that I'm using to build a table in Prawn (pdf builder).  The data will consist of records for a given month.  Since it is hstore, the keys used will likely change from day to day so this needs to be dynamic.</p>
  <p>I need to determine:</p>
  <h1>1 What unique keys are used that month</h1>
  <p>I created a helper to find the unique keys that were used in the month. These will be used as column headers.</p>
  <pre><code> keys(@users_logs)
   # this returns an array like - [&quot;XC&quot;, &quot;PIC&quot;, &quot;Mountain&quot;]
  </code></pre>
  <p>The table will display a users dutylog data for the month.  For testing...If I explicitly call known hstore keys...the data displays correctly.  But, since its hstore...I wont know what the table column will be in production.</p>
  <h1>For testing, I call known hstore keys...this creates the prawn table row data per duty log.</h1>
  <pre><code>@users_logs.map do |dutylog|
          [ dutylog.properties[&quot;XC&quot;], 
            dutylog.properties[&quot;PIC&quot;], 
            dutylog.properties[&quot;Mountain&quot;]
              ]
  end
  </code></pre>
  <p>But, since this is hstore...I wont know what keys to call in production.  So, I need to make the above iteration dynamic.</p>
  <p>I tried, without success, to iterate over each dutylog entry, then iterate over each unique key and output one &quot;dutylog.properties[x]&quot; call for each key value...but, this just outputs the array of key values.  I tried using send() in the block, but that didnt help.</p>
  <pre><code>@users_logs.map do |dutylog|
     [ keys(@users_logs).each { |k| dutylog.properties[k] }.join(&quot;,&quot;) ]
  end
  </code></pre>
  <p>Any ideas on how I could make the &quot;dutylog.properties[k]&quot; dynamic?</p>