concept request format in category rails

This is an excerpt from Manning's book Flexible Rails: Flex 3 on Rails 2.
Note that each method has a comment showing the URL + fake HTTP request combination that triggers it. For example, the index method
(which is triggered by a GET to /tasks or /tasks.xml) finds all the tasks and stores them in @tasks. Then, inside the respond_to block, it checks if the requested format was html (and renders index.html.erb if it was) or xml (and renders @tasks, which is syntactic sugar for @tasks.to_xml).
Earlier, I glossed over something that is fairly deep: I said the respond_to block is used to check if the requested format was html (and renders index.html.erb if it was) or xml (and renders @tasks, which is syntactic sugar for @tasks.to_xml). But how does the client set the requested format, and how is this configured in Rails? To answer that, we need to look at routing. I’ve been ignoring routing up to now; it’s time to change that. Before we proceed, let’s get rid of the Welcome Aboard screen: delete the public\index.html file now. (It overrides the default route, and I’ve been welcomed aboard enough.)
(which is triggered by a GET to /tasks or /tasks.xml) finds all the tasks and stores them in @tasks. Then, inside the respond_to block, it checks if the requested format was html (and renders index.html.erb if it was) or xml (and renders @tasks, which is syntactic sugar for @tasks.to_xml).