前提・実現したいこと
productに紐づいたcategorieのnameを取り出したいのですがキーの部分が重複して取り出されます。
"brand_name":["スニーカー","新作","スポーツ"]
のように取り出したいのですがどうすればよいですか?
エラーメッセージ "brand_name":[{"name":"スニーカー"},{"name":"新作"},{"name":"スポーツ"}] ### 該当のソースコード ```Ruby on Rails ソースコード product_controller.rb module Api class ProductsController < ApplicationController def index @product = Product.find(params[:id]) end end end index.json.jbuilder json.brand_name do json.array! @product.categories, :name end ### 試したこと ### 補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。