title: CoffeeScript generating dynamic variable names for objects (named classes)
body: <p>I'm pretty new to the world of JavaScript and even newer to CoffeeScript. I have a problem and I'm not sure if it's even possible.</p>
  
  <p>Say I have a CoffeeScript class like this</p>
  
  <pre><code>class @Model
    constructor: (@name) -&gt;
  </code></pre>
  
  <p>how could I pass the names of models to be created to a function to instantiate these objects whilst appending the name of the variable [in this case] with _model? Something like:</p>
  
  <pre><code>makeModel = (name) -&gt;
    "#{name}_model" = new Model(name)
  </code></pre>
  
  <p>My rails app tells me that: </p>
  
  <pre><code>unexpected =
        "#{name}_model" = new Model(
                  ^
  </code></pre>
  
  <p>I'm assuming that this is because of the string. Is there some sort of method to convert a string to a variable name? I took a quick look at the <code>.eval()</code> method but <a href="http://arcturo.github.io/library/coffeescript/07_the_bad_parts.html" rel="nofollow">the little book of CoffeeScript</a> warns against it's use.</p>
  
  <p>Thanks</p>