title: How to access instance variables in CoffeeScript engine inside a Slim template
body: <p>I have a Rails controller in which I am setting a instance variable -</p>
  
  <pre><code>@user_name = "Some Username"
  </code></pre>
  
  <p>In my .slim template I am using coffee engine to generate javascript and want to print out the user name from client-sie javascript code -</p>
  
  <pre><code>coffee:
    $(document).ready -&gt;
      name = "#{@user_name}"
      alert name
  </code></pre>
  
  <p>But this is the javascript that is being generated??</p>
  
  <pre><code>$(document).ready(function() {
      var name;
      name = "" + this.my_name;
      alert(name);
  }
  </code></pre>
  
  <p><strong>How do I access controller instance variables in my CoffeeScript code??</strong></p>
  
  <p>I am tagging this as haml since I am guessing haml will have the same issue when using CoffeeScript .</p>