Hello,
I'm working on a Ruby on Rails app which has a REST API. I manage two formats JSON and XML. Very often to simplify the use if the API, I'm making includes. But when you add params to to_json and to_xml like :only, :except, it's not only applied on the root object but on all the objects included.
Do you know libs or methods to answer to these different problems:
- Tell never return a user password in the API
- Tell always include a relationship or a method in each user serialized in the API
- Serialize objects depending on context. For exemple, when a user ask for the user list, he should see its complete profile, a partial profile of its friends and just the name of others...
- Don't have to copy paste the parameters for xml and json
Thank you very much,
Camille Roux