rails 3 render json and include profile from array
All Users have one profile.
Currently have:
render :json => @user, :include => 开发者_开发知识库[:friends, :requested_friends]
Would like to include the profile for friends and requested friends.
I know for a single include I can user this
render :json => @user, :include => {:requested_friends => {:include => :profile}}
But need something like:
render :json => @user, :include => {[:friends, :requested_friends] => {:include => :profile}}
How about:
render :json => @user,
:include => {
:requested_friends => { :include => :profile },
:friends => { :include => :profile }
}
精彩评论