polymorphic_url を使用してルートを生成する際に問題が発生しました
これが私の route.rb ファイルの一部です:
scope path: '/my-account', controller: 'customers/base', as: :customer do
...
resources :addresses, path: 'my-addresses'
...
end
熊手ルート | grepアドレスは、私が望むルートを正確に教えてくれます:
customer_addresses GET /:locale/my-account/my-addresses(.:format)
今、私が使用する場合
send('customer_addresses_path)
link_to では、すべて正常に動作します。
しかし、ポリモーフィック URL で同じ URL を生成できない場合:
app.polymorphic_path([:customer,:addresses])
#ActionController::RoutingError: No route matches {:controller=>"addresses"}
app.polymorphic_path([Customer,:addresses])
#"/Customer/my-account/my-addresses" Not the same url :'(
app.polymorphic_path([Customer.first,:addresses])
#"/1/my-account/my-addresses" Not the same url :'(
polymorphic_url を使用して URL を生成する方法はありますか?