title: How to convert a complex string into Hash in rails 3.2?
body: <p>Here is a <code>complex_string</code> which we would like to convert into Hash {:stats => str1, :search => str2}:</p>
  
  <pre><code>:stats =&gt;  {&lt;%=t('Payment Total($)') %&gt;:&amp;nbsp;&amp;nbsp;&lt;%= number_with_precision(number_with_delimiter(@s_s_results_details.models.joins(:contract =&gt; :payments).sum(:paid_amount)), :precision =&gt; 2) %&gt;
  &lt;%=t('Contract Total($)') %&gt;:&amp;nbsp;&amp;nbsp;&lt;%= number_with_precision(number_with_delimiter(@s_s_results_details.models.joins(:contract).sum(:contract_amount)), :precision =&gt; 2) %&gt;},
  :search =&gt;  {}
  </code></pre>
  
  <p>In the end, we would like to assign str1 and str2 to 2 variables. We tried to use <code>eval(complex_string)</code> and there is error:</p>
  
  <pre><code>"(eval):1: syntax error, unexpected =&gt;, expecting end-of-input :stats =&gt; {&lt;%=t('Payment Tota...          ^"
  </code></pre>
  
  <p>It seems that the <code>=&gt;</code> in the string causes error. Is there a way we can convert <code>complex_string</code> into hash? Thanks.</p>