On 8 Jan 2008, at 14:36, Ruben Fonseca wrote:
>
> Hi!
>
> I''ve a Rails 2.0 site using RESTful resources. I added JSON
support
> too, so the model can be get through HTML (using my views), XML and
> JSON (using .to_xml and .to_json)
to_xml/to_json take :except or :only options
Fred>
>
> The problem is that I want to hide some fields on the XML and JSON
> output (the HTML isn''t a problem, because I control what I want to
> show on the view). For example, on the User model, I don''t want to
> send the ''password'' field via XML or JSON.
>
> What''s the best way to do this, and do it DRY around all RESTful
> methods? The only solution I was thinking is to write xml.builder and
> json.builder but there should be a easy way :-)
>
> Greetings,
> Ruben
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---