title: How to Dynamically name a Hash key in Ruby
body: <p>I'm trying to make a 'render' call in an erb file where the key of the hash is dynamically named. For example...</p>
  
  <pre><code>&lt;% object_type_abbr = ["pos", "job_description", "policy", "procedure", "step", "task", "product"] %&gt;
  
  &lt;%= render path.to_s, 
          model_id: @model.id,
          object_type_abbr[i]: orphan,
          row_no: row_no,  
          is_orphan: true 
  %&gt;
  </code></pre>
  
  <p>The problem is this syntax is not recognized. I have tried using the #{ruby var name} syntax (suggested <a href="https://stackoverflow.com/questions/21321886/dynamically-creating-hash-key-name-in-rails-4">here</a>), but of course this doesn't work in HTML. </p>
  
  <p>I've also tried object_type_abbr[i].to_sym, which makes no difference. </p>
  
  <p>I know this has to exist, but can't find it.</p>