Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

.js files fallback on .html if view is missing

#6076

Notice that in the below given case I do NOT have index.js.erb.

  def index
    @users = User.all
    respond_to do |format|
      format.js  { render }
    end
  end

  #views
  index.html.erb (present)
  index.js.erb (not present)

Now if I request http://localhost:3000/users.js then I do not get template missing error. Rather I get index.html.erb file. And that is because of this code https://github.com/rails/rails/blob/master/actionpack/lib/action_vi...

Any particular reason why the code is the way it is. There is a corresponding test also for that line of code.

Reported by Neeraj Singh · November 28th, 2010 @ 02:45 AM

State: wontfix
Milestone: 3.x
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. José Valim
    José Valim
    • State changed from new to wontfix

    This is a backward compatibility schema because some people were used to return a full html page for xhr? or js? requests. I am glad you are looking at this and getting more and more familiar with the code. :)

    November 28th, 2010 @ 08:53 AM