You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace :dealer, path: '' do
resources :images, except: :index do
resources :comments, only: [:create, :destroy] do
resources :attachments, only: :show
end
end
end
In my view using link_to [@image, @comment] results in a url named:
dealer_image_dealer_comment_path which doesn't exist. It should be dealer_image_comment_path. Any way to avoid the double namespace?
I'm receiving this error:
undefined method `dealer_image_dealer_comment_path' for #<#<Class:0x007fb599499520>:0x007fb5994980d0>
Did you mean? dealer_image_comments_path
dealer_image_comment_path
rake routes:
dealer_image_comments POST /images/:image_id/comments(.:format) dealer/comments#create {:subdomain=>"dealer"}
dealer_image_comment DELETE /images/:image_id/comments/:id(.:format)
Rails version: 5.0.2
Ruby version: 2.4.0
The text was updated successfully, but these errors were encountered:
@cristian-rivera are you using namespaces for your models, e.g. Dealer::Image and Dealer::Comment ? If so this is a limitation of the way polymorphic_url works. It effectively guesses the url helper name based on the model name and namespaces can cause it to go wrong.
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 5-1-stable branch or on master, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
I have routes defined like this:
In my view using
link_to [@image, @comment]
results in a url named:dealer_image_dealer_comment_path
which doesn't exist. It should bedealer_image_comment_path
. Any way to avoid the double namespace?I'm receiving this error:
rake routes:
Rails version: 5.0.2
Ruby version: 2.4.0
The text was updated successfully, but these errors were encountered: