How to use the same params in respond_to for some formats?

Hello,

I want to make an API in XML and JSON (maybe more), and I want most of
the time use the same parameters for the to_xml and the to_json (same
:include, :only, :except, :methods).
In your opinion, what is the best way to do that?

Thank you
Camille R.

Camille R. wrote:

I want to make an API in XML and JSON (maybe more), and I want most of
the time use the same parameters for the to_xml and the to_json (same
:include, :only, :except, :methods).
In your opinion, what is the best way to do that?

respond_to is not a ruby method. My guess is that you are writing an
application in Rails. Rails has its own forums and you would do best to
ask there; this forums is for the Ruby programming language.