ユーザーがログインしていない場合にbefore_filter
リダイレクトされることを確認するために、統合テストを実行しています。どこかに見逃した設定がある場合。ありがとう!root_path
http://www.example.com/
Redirected to
log/test.log
ログ/test.log
Started PUT "/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