简体   繁体   English

ActionController::RoutingError(未初始化的常量)

[英]ActionController::RoutingError (uninitialized constant)

I have a problem with my road and I do not understand why he told me "Dashboard::TasksController " because in my controller file contains the file dashbaord / tasks.rb我的道路有问题,我不明白他为什么告诉我“Dashboard::TasksController”,因为在我的控制器文件中包含文件 dashbaord/tasks.rb

class TasksController < ApplicationController

def add_task
    @t = "test"
end

end结尾

in my config / routes file I did this在我的配置/路由文件中我做了这个

match '/dashboard/add-task' => "dashboard/tasks#add_task", via: [:get, :post]

in folder view view/dashbaord/tasks/add_task.html.erb在文件夹视图视图/dashbaord/tasks/add_task.html.erb

So I do not see or is my mistake.所以我没有看到或者是我的错误。

Thank you谢谢

Firstly, your controller file should be named tasks_controller.rb .首先,您的控制器文件应命名为tasks_controller.rb Secondly, your TasksController should be namespaced:其次,你的TasksController应该被命名空间:

class Dashboard::TasksController < ApplicationController
  # content
end

就我而言,我没有使用 Rails CLI 生成控制器,因此我输入了错误的文件名...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActionController :: RoutingError(未初始化的常量ImporterController): - ActionController::RoutingError (uninitialized constant ImporterController): ActionController::RoutingError(未初始化的常量 IndexController - ActionController::RoutingError (uninitialized constant IndexController ActionController :: RoutingError(未初始化的常量BaseController) - ActionController::RoutingError (uninitialized constant BaseController) ActionController :: RoutingError:未初始化的常量MicropostsController - ActionController::RoutingError: uninitialized constant MicropostsController ActionController::RoutingError(未初始化的常量用户): - ActionController::RoutingError (uninitialized constant Users): Rails 5-ActionController :: RoutingError(未初始化的常量PeopleController) - Rails 5 - ActionController::RoutingError (uninitialized constant PeopleController) Heroku ActionController :: RoutingError(未初始化的常量错误) - Heroku ActionController::RoutingError (uninitialized constant error) Ruby-RoR。 ActionController :: RoutingError(未初始化的常量…) - Ruby - RoR. ActionController::RoutingError (uninitialized constant …) ActionController :: RoutingError-未初始化的常量ApplicationController :: CanCan: - ActionController::RoutingError - uninitialized constant ApplicationController::CanCan: ActionController :: RoutingError(未初始化的常量UserfeedController :: BLL): - ActionController::RoutingError (uninitialized constant UserfeedController::BLL):
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM