gpt4 book ai didi

ruby-on-rails - ActionController::RoutingError: 未初始化的常量 MicropostsController

转载 作者:行者123 更新时间:2023-12-03 14:40:46 24 4
gpt4 key购买 nike

更新 : 这是因为文件名拼写错误

正确的:~/sample_app/app/controllers/microposts_controller.rb
不正确:~/sample_app/app/controllers/microposts_contoller.rb
这是我在这里的第一个贡献,感谢有关改进此帖子或 future 帖子的反馈:)

Ruby on Rails 教程:Learn Web Development with Rails 4

在完成章节 10.3 的同时, 我被困。最后,一个拼错的文件名让我追了几天鬼。

$ rspec spec/requests/authentication_pages_spec.rb
No DRb server is running. Running in local process instead ...
...FF................

Failures:

1) Authentication authorization for non-signed-in users in the Microposts controller submitting to the create action
Failure/Error: before { post microposts_path }
ActionController::RoutingError:
uninitialized constant MicropostsController
# ./spec/requests/authentication_pages_spec.rb:93:in `block (6 levels) in '

2) Authentication authorization for non-signed-in users in the Microposts controller submitting to the destroy action
Failure/Error: before { delete micropost_path(FactoryGirl.create(:micropost)) }
ActionController::RoutingError:
uninitialized constant MicropostsController
# ./spec/requests/authentication_pages_spec.rb:98:in `block (6 levels) in '

Finished in 0.92253 seconds
21 examples, 2 failures

Failed examples:

rspec ./spec/requests/authentication_pages_spec.rb:94 # Authentication authorization for non-signed-in users in the Microposts controller submitting to the create action
rspec ./spec/requests/authentication_pages_spec.rb:99 # Authentication authorization for non-signed-in users in the Microposts controller submitting to the destroy action

最佳答案

这是由于拼写错误的文件名 ~/sample_app/app/controllers/microposts_controller.rb (是 microposts_contoller.rb)

关于ruby-on-rails - ActionController::RoutingError: 未初始化的常量 MicropostsController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18391048/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com