I am using respond_to in one of my actions to render html, rss, or atom based on the http request. This is what my code looks like:
respond_to do |wants| wants.html wants.rss { render_rss_feed_for @ideas, options } wants.atom { render_atom_feed_for @ideas, options end
It works perfectly, but looking at the logs, this action is called 3 times
Processing IdeaController#list (for 127.0.0.1 at 2007-02-26 18:54:53) [GET] Parameters: {“action”=>“list”, “controller”=>“idea”} Rendering layoutfalsecontent_typetext/htmlactionlist within layouts/application
Rendering idea/list Completed in 0.98500 [http://localhost/]
Processing IdeaController#list (for 127.0.0.1 at 2007-02-26 18:54:55) [GET] Parameters: {“format”=>“rss”, “action”=>“list”, “controller”=>“idea”}
Completed in 0.15600 [http://localhost/?format=rss]
Processing IdeaController#list (for 127.0.0.1 at 2007-02-26 18:54:55) [GET] Parameters: {“format”=>“atom”, “action”=>“list”, “controller”=>“idea”}
Completed in 0.15600 [http://localhost/?format=atom]
Anyone know why this is happening? Shouldn’t it only process the controller once depending on the “format” param of the request? This is a development machine so I know a RSS reader is not requesting the action.