Forum: Ruby on Rails respond_to strangeness

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0a5d6fa912dda67f9b81017fbd9a81f2?d=identicon&s=25 Shane Sherman (Guest)
on 2007-02-27 20:45
(Received via mailing list)
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.
This topic is locked and can not be replied to.