title: ruby inside javascript block [slim template]
body: <p>There is a way to put ruby conditions inside javascript block? i.e.</p>
  
  <pre><code>javascript:
    var config = {
        common_value_1 : 1, 
        common_value_2 : 2 
    };
    - if my_value === true # this must be a ruby condition
      config.custom_true_value_1 = "1" ;
      config.custom_true_value_2 = "#{my_value}" ;
    - else
      config.custom_false_value_1 = "1" ;
      config.custom_false_value_2 = "#{my_value}" ;
  </code></pre>
  
  <p>Or is there another workaround at this problem? Because the ugly way that I can use its:</p>
  
  <pre><code>javascript:
      var config = {
        common_value_1 : 1, 
        common_value_2 : 2 
      };
  - if my_value === true # this must be a ruby condition
    javascript:
      config.custom_true_value_1 = "1" ;
      config.custom_true_value_2 = "#{my_value}" ;
  - else
    javascript:
      config.custom_false_value_1 = "1" ;
      config.custom_false_value_2 = "#{my_value}" ;
  </code></pre>
  
  <p>But I don't like it because if config has common values between if and else then I would duplicate my code and would be much larger and hard to maintain.</p>
  
  <p><strong>Updated with better examples</strong></p>