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

30 views
Skip to first unread message

David Morales

unread,
Feb 6, 2012, 9:49:31 AM2/6/12
to rubyonra...@googlegroups.com
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:

my_controller.rb:

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?
Reply all
Reply to author
Forward
0 new messages