title: Rails: How to initialize an object with the attributes in strings?
body: <p>Probably been working on this too long, sloppy design, or both.  My issue is I have a model I wish to initialize.  The object has like 52 attributes, but I'm only setting a certain ~25 depending on which object I've just scanned.  When I scan an object I get the columns and match them up with a hash_map I've created.</p>
  
  <p><strong>Example Hash Map</strong></p>
  
  <p>This just matches the scanned text to their respective attribute name.</p>
  
  <pre><code>hash_map = {"Pizza."=&gt;"pizza_pie","PastaBowl"=&gt;"pasta_bowl","tacos"=&gt;"hard_shell_taco","IceCream"=&gt;"ice_cream","PopTarts"=&gt;"pop_tart"}
  </code></pre>
  
  <p><strong>What I want to do</strong></p>
  
  <pre><code>menu = RestaurantMenu.new(pizza_pie =&gt; var1, pasta_bowl =&gt; var2, ...)
  </code></pre>
  
  <p>My only problem is in my code at the moment I have this...</p>
  
  <pre><code>t.rows.each do |r|
    for i in 0..r.length-1
       #hash_map[t.combined_columns[i]] =&gt; r.[i]
       puts "#{hash_map["#{t.combined_columns[i]}"]} =&gt; #{r[i]}"
    end
  end
  </code></pre>
  
  <p>the <code>puts</code> line displays what I want, but unsure how to get that in my app properly.</p>