我的视图文件夹有这样的结构(它们显示逻辑结构):
所以我在管理子文件夹中有子文件夹,在目录文件夹中我必须有子文件夹、制造商等(制造商和其他有控制器的视图,只有目录和为空)
和 rails 自动为我生成了这样的路线:
namespace :admin do
namespace :catalogs do
namespace :to do
namespace :manufacturers do
namespace :models do
namespace :types do
resources :articles
end
end
end
end
end
end
namespace :admin do
namespace :catalogs do
namespace :to do
namespace :manufacturers do
namespace :models do
resources :types
end
end
end
end
end
namespace :admin do
namespace :catalogs do
namespace :to do
namespace :manufacturers do
resources :models
end
end
end
end
namespace :admin do
namespace :catalogs do
namespace :to do
resources :manufacturers
end
end
end
制造商,型号,类型工作正常,但文章工作奇怪......当我尝试写这样的形式部分:
= form_for [:admin, :catalogs, :to, :manufacturers, :models, :types, @art] do |f|
= f.label "OEM"
= f.text_field :oem_number
= f.label "Бренд"
= f.text_field :manufacturer
= f.label "Название"
= f.text_area :name
= f.label "Кол-во"
= f.text_field :quantity
= f.label "Комментарий"
= f.text_area :details
= f.label "Только с VIN"
= f.check_box :only_with_vin
= f.hidden_field :type_id, @type_id
.form-actions
= f.submit 'Сохранить изменения', :class => "btn btn-primary"
事情很糟糕,我得到了#<#:0xbbedf60> 的未定义方法`admin_catalogs_to_manufacturers_models_types_to_articles_path'
但例如在类型中我有这样的形式:
= form_for [:admin, :catalogs, :to, :manufacturers, :models, @man] do |f|
%b
= @man.Name
%br
= @man.TYP_PCON_START.to_s[4...6].concat("-").concat(@man.TYP_PCON_START.to_s[0...4])
\-
-if @man.TYP_PCON_END.blank?
= "наст. время"
-else
= @man.TYP_PCON_END.to_s[4...6].concat("-").concat(@man.TYP_PCON_END.to_s[0...4])
%br
= ((@man.TYP_HP_FROM.to_f*0.74).round).to_i
kW
= f.label "Отображать в списке ТО?"
= f.check_box :is_in_to
.form-actions
= f.submit 'Сохранить', :class => "btn btn-danger"
= link_to 'Назад', :back, :class => "btn"
一切都好,文章有什么问题?如何以及如何改变我的路线并优化它?我尝试了一下,但得到错误......