我運行集成測試,以確保我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