我运行集成测试,以确保我before_filter
被重定向到root_path
如果用户没有登录。似乎一切都工作正常,但我在log/test.log
看到http://www.example.com/
在Redirected to
消息,我只是想知道这是否正常,或者是否有配置,我错过了某个地方。谢谢!为什么`log/test.log`在`Redirected to`消息中显示`http:// www.example.com /`?
日志/ test.log中
Started PUT "https://stackoverflow.com/users/980190963" for 127.0.0.1 at 2012-07-29 13:31:39 -0700
Processing by UsersController#update as HTML
Parameters: {"user"=>{"password"=>"[FILTERED]"}, "id"=>"980190963"}
Redirected to http://www.example.com/
Filter chain halted as :reject_if_logged_out rendered or redirected
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
users_controller.rb
...
before_filter :reject_if_logged_out, only: [:update]
...
private
def reject_if_logged_out
redirect_to root_path unless @current_user
end