Nested model json

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?
want all the 3 datas(users, sub_users_address at a time)

For single nested I tried - respond_with @users.to_json(:include =>


Ok found the solution:-
*respond_with(@users, :include => {:sub_users => {:include =>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs