So when one generates scaffodl, the controller automatically creates these blocks(?) like this
respond_to do |format|
format.html
format.xml { render :xml => @c }
end
what does this really do and how come it has format.html and format.xml? What does each do?
It defines that the current action will respond to various formats (the action’s content can be rendered in many ways, not only plain old HTML).
/my/path/to/action.html, it will render HTML (from the template);/my/path/to/action.xml, it will render XML using{ render :xml => @c }. XML will be generated by Rails by calling theto_xmlmethod on the@cvariable;/my/path/to/action.json, it will throw a 404 error.