%body
- flash.each do |key, value|
- key = "info" if key == "notice"
- key = "danger" if key == "alert"
= content_tag :div, value, class: "alert alert-#{key}"
class SamplesController < ApplicationController
def create
review = current_user.reviews.new(review_params)
if review.save
redirect_to books_url, success: "Successfully created your prototype."
else
redirect_to root_url, warning: "Unfortunately failed to create."
end
end
end
class ApplicationController < ActionController::Base
# フラッシュメッセージのキーを追加
add_flash_types :success, :info, :warning, :danger
end