Ruby on Rails Sunday, March 31, 2013

Sorry, I haven't seen the action that you post in the beginning

def who_bought
    @product = Product.find(params[:id] )
    respond_to do |format|
      format.xml { render :xml => @product.to_xml( :include => :order )
      format.json {render :json => @product.to_json(:include => :order )

It should be @product.to_xml(:include => :orders)
Note the plural

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
To post to this group, send email to
For more options, visit

No comments:

Post a Comment