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.html
      format.xml { render :xml => @product.to_xml( :include => :order )
}
      format.json {render :json => @product.to_json(:include => :order )
}
    end
  end

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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment