ruby - Rails as_json not including all associations -
for arguments sake, lets have legs object. i'm trying call as_json on , include associations - set correctly works in console.
this have:
@legs.as_json( :include => { :shoes => { :include => { :left_shoe => { :include => { :shoe_lace => {:include => :sock} } } }, :right_shoe => { :include => { :shoe_lace => {:include => :sock} } } } } )
for reason it's not including right_shoe. stops @ left_shoe. ideas?
i think per comments right shoe @ wrong level. try this:
@legs.as_json( :include => { :shoes => { :include => { :left_shoe => { :include => { :shoe_lace => {:include => :sock} } }, :right_shoe => { :include => { :shoe_lace => {:include => :sock} } } } } } )
Comments
Post a Comment