Rails routing with subfolders: namespaces and resources

↘锁芯ラ 提交于 2020-01-05 09:31:49

问题


I have such route:

  namespace admin
    namespace :catalogs do
      namespace :to do
        resources :manufacturers do 
          resources :models do 
            resources :types do
              resources :details
            end
          end
        end
      end
    end
  end

(please do not ask what's the model, why so man sub's: it must be so)

and such folder structure:

in manufacturer index view i have link: = link_to "Подробнее", admin_catalogs_to_manufacturer_model_path(c), :class=>'btn btn-primary'

(also rake routes say that it is right route)

and when i try to render my index view i get:

No route matches {:action=>"show", :controller=>"admin/catalogs/to/models", :manufacturer_id=>#}

when i custom my link to :

= link_to "Подробнее", admin_catalogs_to_manufacturer_model_path(manufacturer_id: c.MFA_ID, id: c.MFA_ID)

i get error

uninitialized constant Admin::Catalogs::To::ModelsController

what is wrong? how to solve my routing?

来源:https://stackoverflow.com/questions/16979826/rails-routing-with-subfolders-namespaces-and-resources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!