Probably a good case for an Active Model Serializer tailored to that specific 
use case (JSON structure)


> On Nov 26, 2014, at 3:03 AM, Zhao Difei <[email protected]> wrote:
> 
> Greetings all,
> 
>   I have a json object (text) to render, formatted as:
> 
> {
> "a": "b",
> "c":
> [ { "id": "abracadabra",
> "data": "good" }
> { "id": "abracxxabra",
> "data": "goodsss" } ]
> }
> 
>   How could exclude the id fields from rendering, I tried different 
> combinations:
> 
> render json: obj, except: [ c: [ "id" ] ]
> render json: obj, include: [ c: [ except: "id" ] ]
> 
>   none of them works, any ideas? Thanks in advance.
> 
> Cheers,
> Difei
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/2cd584c3-a4f0-4ced-9dfa-0b89f61f89d6%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/rubyonrails-talk/2cd584c3-a4f0-4ced-9dfa-0b89f61f89d6%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

----

Jason Fleetwood-Boldt
[email protected]
http://www.jasonfleetwoodboldt.com/writing

All material © Jason Fleetwood-Boldt 2014. Public conversations may be turned 
into blog posts (original poster information will be made anonymous). Email 
[email protected] with questions/concerns about this.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/DC98233F-AE82-4E51-9A06-9B1C247BDC26%40datatravels.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to