【 Ruby on Rails 】自分のFlash message をカスタムする

app/controllers/application_controller.rb
class ApplicationController
  add_flash_types :good, :bad
end
app/controllers/users_controller.rb
class UsersController < ApplicationController
  def create
    redirect_to root_path, good: "Created user!"
  end
end
app/views/users/index.html.erb
<%= good %>
Created by Yuto at 2022-01-21 17:42
0
Like this article