Nested model json

Avi
Wed, 06 Feb 2013 05:24:24 -0000

Hello All,

I have model relationship as :-

users has_many sub_users
sub_users has_many address

How can I do a nested json call?
I am getting sub_users value. How can I get address values through json? I
want all the 3 datas(users, sub_users_address at a time)

For single nested I tried - *respond_with @users.to_json(:include =>
[:sub_users])*

Thanks,
Avi


--
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
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/VFdF30nMgdcJ.
For more options, visit https://groups.google.com/groups/opt_out.