How to get rails 3 to respons with js?

Hi All,
Does anyone have experience with rails 3 refusing to return js (or
some other format) in controller actions that are designed to return
both html and some other format? I have the following code:

respond_to :html, :js

def index
@artist = Artist.find_by_url(params[:artist_id])
@tour_dates = TourDate.for_artist(@artist)
respond_with(@tour_dates)
end

When I do a js request for this action it renders and returns my
index.html.erb as the response body, even though i have a nice
index.js.erb file. Here’s the log:

Started GET “/admin/artists/aube/tour_dates” for 127.0.0.1 at
2010-09-29 13:08:07 -0400
Processing by Admin::TourDatesController#index as JS
Parameters: {“artist_id”=>“aube”}

Rendered collection (0.0ms)
Rendered admin/tour_dates/index.html.erb (2.5ms)
Completed 200 OK in 266ms (Views: 35.8ms | ActiveRecord: 2.5ms)

Any idea why rails it not handling the non-html formats properly?
Thanks,
Sean

[email protected] wrote:

When I do a js request for this action it renders and returns my
index.html.erb as the response body, even though i have a nice
index.js.erb file. Here’s the log:

What about index.rjs instead of index.js.erb? That should work.