Assign product and add it to json output @product = Product.where(condition) json = {product_detail: @product}
json when you define it is a ruby hash google ruby hash
no, l want include product_detail on json, if i using includes: { :product_detail => {only: [:name]} } error product_detail no defined on invoice but product_detail is in @cart
yes you working with variable json, its a hash to include key-pair into json variable google ruby hash
what are relations between card, product and product_detail?
cart belongs_to :poduct belongs_to :product_detail
Check your model You write poduct instead pRoduct
You asked to include producti_detail to json not to cart
Colorscheme, please
sorry 🙏 i want product_detail to json before i know on render, but i now know as_json include
no worries about me, but for the future: you can't find right anwer on wrong question
oke i fixed it for the next question, thank you very much
Обсуждают сегодня