title: Coffee script definitions get ignored when using :remote => true and js.erb-responses
body: <p>Okay, consider the following:
  A <code>app/views/pages/index.html.erb</code>, consisting of: </p>
  
  <pre><code>&lt;div id='content'&gt;    
    &lt;%= link_to 'Test', get_page_path('test'), :remote =&gt; true %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>A definition in <code>app/controllers/pages_controller.rb</code> like this:</p>
  
  <pre><code>def get
    @page = Page.new(:title =&gt; '404', :content =&gt; '&lt;strong&gt;Page not found&lt;/strong&gt;') unless @page = Page.find_by_title(params[:title])
    respond_to do |format|
      format.html
      format.js
    end
  end
  </code></pre>
  
  <p>A javascript asset in <code>app/assets/javascripts/pages.js.coffee</code> like this:</p>
  
  <pre><code>bork = (swedish) -&gt; alert swedish
  $ -&gt;
    bork 'bork bork'
  </code></pre>
  
  <p>And finally a <code>app/views/pages/get.js.coffee</code> like this:</p>
  
  <pre><code>bork 'Smoerrebroed'
  $('#content').html '&lt;%= escape_javascript(@page.content).html_safe %&gt;'
  </code></pre>
  
  <p>So, here's the fun part - I do see the 'bork bork' alert once as expected. However, after clicking on the link, only the content gets replaced (as indicated by the second line), I don't see a 'Smoerrebroed' alert.
  The <code>pages.js.coffee</code> stuff is obviously included - but seems to be inaccessible outside the page itself. As such, the compartmentalization Rails is doing is not very useful - why exactly should I put my 'pages controller' specific stuff into <code>pages.js.coffee</code> when it is only accessible inside that specific script? Is there any way to work around that?
  It seems to based on the fact that coffee script wraps everything inside a</p>
  
  <pre><code>(function() {
    //specific stuff here
  }).call(this);
  </code></pre>
  
  <p>which supposedly is there to prevent the script from executing before the page has loaded. Is there some way of telling coffeescript to stop doing that because I'm using the <code>$ -&gt;</code>(shorthand) or <code>$(document).ready()</code> function anyway...</p>