2022-08-22 Rails redirect_to with Flash message/anchor
redirect_to with Flash message
Flashメッセージとともにリダイレクトするやつ。
redirect_to post_url(@post), alert: "Watch it, mister!"
redirect_to post_url(@post), status: :found, notice: "Pay attention to the road"
ActionController::Redirecting | RailsDoc(β)
redirect_to with anchor
名前付きルートの引数に anchor: 'xxx'
を指定すればOK。
redirect_to user_path(@user, anchor: 'anchor-id')