CartおよびCartItem( belongs_to :cart) モデルの構成を取得しました。
私がしたいのは、の代わりに、をpolymorphic_path([@cart, @cart_item])使用するように呼び出すことです。cart_item_pathcart_cart_item_path
ルートによって生成された URL を に変更できることはわかっていますが/carts/:id/items/:id、それは私が興味を持っていることではありません。また、名前CartItemをに変更することItemはオプションではありません。cart_item_pathアプリ全体でメソッドを使用したいだけです。
それについてのヒントを事前にありがとう!
私の主張を明確にするために:
>> app.polymorphic_path([cart, cart_item])
NoMethodError: undefined method `cart_cart_item_path' for #<ActionDispatch::Integration::Session:0x007fb543e19858>
では、私の質問を繰り返しますが、polymorphic_path([cart,cart.item])を検索して検索しcart_item_pathないようにするにはどうすればよいcart_cart_item_pathでしょうか?