Why file.js.coffee.erb is not working with respond_to?

I would like to know why a coffee-script file is not working when it’s named as file.js.coffee.erb and used with respond_to.

This is an example:


def create respond_to do |format| format.html { render :new } format.js { render :new } end end

The file in this case is named new.js.coffee.erb

When the create route is called with Ajax, the HTML version (new.html.erb) is always returned. If I rename the js file as new.js.coffee then it works correctly.

Why can’t the .erb suffix be added?