title: Getting "Uncaught ReferenceError" despite the fact I have defined my function in my coffee script
body: <p>I’m using Rails 4.2.4 and trying to create an “Edit” link that will invoke a jQuery function when clicked.  So I put this in my view …</p>
  
  <pre><code>&lt;%= link_to 'Edit', '#', :onclick =&gt; "editMyObject(#{my_object_time.my_object.id})" %&gt;
  </code></pre>
  
  <p>and then in my app/assets/javascripts/users.coffee script, I have</p>
  
  <pre><code>editMyObject = (id) -&gt;
      # Populate the total for the day
      $.ajax
        url: "/my_objects/edit"
        type: 'GET'
        data: {id: id}
        success: (data) -&gt;
          # populate my form here 
        error: -&gt;
          alert "Something went wrong getting the data"
  </code></pre>
  
  <p>However, when I click on the link, I get this Javascript error …</p>
  
  <pre><code>Uncaught ReferenceError: editMyObject is not defined
  </code></pre>
  
  <p>I have verified that my coffee script is loaded on the page, but I can’t figure out what’s wrong with the above that makes the browser think the function is undefined.</p>