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 }

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

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

Why can’t the .erb suffix be added?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs