The format matters when you use Rails automatic responders. See http://api.rubyonrails.org/classes/ActionController/MimeResponds.html#method-i-respond_with .
So, for example, with:
class CarsController < ActionController::Base respond_to :html, :js def index respond_with Car.all end end
The application will display app/views/cars/index.html.erb
and app/views/index.js.erb
when viewing http://localhost:3000/cars
and http://localhost:3000/cars.js
respectively.
Itβs also an established agreement in Rails-land, so itβs just a good idea to do it anyway, even if you donβt use answering machines.
source share