Copy
app/controllers/application_controller.rb
1
2
3
class ApplicationController
add_flash_types :good, :bad
end
Copy
app/controllers/users_controller.rb
1
2
3
4
5
class UsersController < ApplicationController
def create
redirect_to root_path, good: "Created user!"
end
end
Copy
app/views/users/index.html.erb
1
<%= good %>
この記事はQiitaのマイページにも掲載しました。
Updated by Yuto at 2023-05-09 21:05