erb not fully rendering .js.erb files

(Disclaimer: I'm new to rails, and running with rails --version: Rails 3.0.0.beta)

The quick overview of what I'm trying to do:

When the user hits a button that's part of a table row, send an async POST to my server, which (assuming success) will respond with some javascript to twiddle the class of that table row.

All of this is happening fine, except that my js.erb file doesn't seem to be being rendered correctly. I'm seeing the <% %> code executed (after throwing in a print, via WEBrick), but <%= %> substitutions aren't being made. Note that .html.erb files come out fine.

Can anyone tell me what I'm doing wrong?

I'm making the button with:

<%= button_to 'C', correct_result_path(row), :remote => true, :method => :post %>

The relevant controller function is:

    def correct       @result = Result.find(params[:id])       @result.correct!       @error =

      respond_to do |format|         format.js       end     end

My most basic "correct.js.erb" looks like this:     <%     p "correct.erb.js is being processed."     %>

    var el = document.getElementById("<%= escape_javascript(@result.result_dom_id) =>");     el.setAttribute('class', 'correct-result');

The POST response looks like this (as viewed through firebug):

    var el = document.getElementById("<%= escape_javascript(@result.result_dom_id) =>");     el.setAttribute('class', 'correct-result');

And here's the WEBrick output when I POST to /results/481/correct:

    "correct.erb.js is being processed."

  Started POST "/results/481/correct" for at 2010-03-15 04:58:10       Processing by ResultsController#correct as JS     Parameters: {"id"=>"481"}     [... cut SQL tracing ...]     Rendered results/correct.js.erb (0.5ms)   Completed in 41ms (Views: 1.9ms | ActiveRecord: 1.4ms) with 200



You've closed that erb tag with => rather than %>