我正在关注 4.0 版本的 rails 指南,我正在使用 PostController 和 CommentController 的示例。
当我使用
http_basic_authenticate_with name: "dhh", password: "secret", except: [:index, :show]
在 postController 中,它不会询问登录身份验证内容,而是创建了我们的评论。
但我定义的方式相同
http_basic_authenticate_with name: "dhh", password: "secret", only: :destroy
在commentController 中并且它正在工作,在删除评论之前它要求身份验证。
所以,我希望身份验证也应该在创建评论之前工作。我检查了我的 rails 版本是 4.0,ruby 版本是 1.9.3p194