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"

ref. ActionController::Redirecting | RailsDoc(β)

redirect_to with anchor

名前付きルートの引数に anchor: 'xxx'を指定すればOK。

redirect_to user_path(@user, anchor: 'anchor-id')
url_for controller: 'tasks', action: 'testing', host: 'somehost.org', anchor: 'ok', only_path: true

ref. ActionDispatch::Routing::UrlFor | RailsDoc(β)