Ruby on rails Rails命名空间帮助程序不工作
在app/controllers/admin中,我创建了dashboad_controller.rb:Ruby on rails Rails命名空间帮助程序不工作,ruby-on-rails,routing,Ruby On Rails,Routing,在app/controllers/admin中,我创建了dashboad_controller.rb: class Admin::DashboardController < ApplicationController def index end end 和其他路线。My route.rb如下所示: namespace :admin do resources :activity_logs end 当我尝试使用帮助器创建链接时: = link_to 'Activi
class Admin::DashboardController < ApplicationController
def index
end
end
和其他路线。My route.rb如下所示:
namespace :admin do
resources :activity_logs
end
当我尝试使用帮助器创建链接时:
= link_to 'Activity Log', admin_activity_logs
我明白了
undefined local variable or method `admin_activity_logs' for #<#<Class:0x106077ec8>:0x1060760c8>
未定义的局部变量或方法“admin\u activity\u logs”#
为什么?您忘记了
\u路径
= link_to 'Activity Log', admin_activity_logs_path
或者url有点不同
= link_to 'Activity Log', admin_activity_logs_path