map.resources route generation: :format and variables

In my config/routes.rb I have:
map.resources :discussions

But I can't generate proper URLs:

discussions_path(:format => :xml) -> /discussions?format=xml instead
of /discussions.xml

discussion_path(discussion, :format => :xml) -> "You have a nil object
when you didn't expect it! The error occurred while evaluating

discussion_path(discussion, :format => :xml) -> /discussions/1?
format=xml instead of /discussions/1.xml

What gives here? Am I calling the route generation wrong? Is there
something I need to add to my routes? Can anyone give me an example of
how to generate the urls correctly?

discussions_path(:format => :xml) -> /discussions?format=xml instead
of /discussions.xml

Try formatted_discussions_path(:xml), etc.

Thanks, that solved it:

formatted_discussions_path(:format => :xml, 'foo' => 'bar') -> /
formatted_discussion_path(:id => @discussions.first, :format => :xml,
'foo' => 'bar') -> /discussions/1.xml?foo=bar