My Rails views and controllers are littered with redirect_to, link_to, and form_for method calls. Sometimes link_to and <
I'm in favor of using PolymorphicRoutes or url_for to dynamically generate routes based on the resource, any namespace, etc.
https://api.rubyonrails.org/classes/ActionDispatch/Routing/PolymorphicRoutes.html
https://api.rubyonrails.org/classes/ActionDispatch/Routing/UrlFor.html
polymorphic_url([:admin, @article, @comment])
# => admin_article_comment_url(@article, @comment)
edit_polymorphic_path(@post)
# => "/posts/1/edit"
With admin namespace
url_for([:admin, Role])
# => "admin/roles" # index
url_for([:admin, Role, action: :new])
# => "admin/roles/new" # new
url_for([:admin, @role])
# => "admin/roles/1" # show; for destroy, use link "method: :delete"
url_for([:edit, :admin, @role])
# => "admin/roles/1/edit" # edit