Last active
February 8, 2018 13:43
-
-
Save nashirox/dd736f561f40aef84a49b3ca5efcf2b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%body | |
- flash.each do |key, value| | |
- key = "info" if key == "notice" | |
- key = "danger" if key == "alert" | |
= content_tag :div, value, class: "alert alert-#{key}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
# フラッシュメッセージのキーを追加 | |
add_flash_types :success, :info, :warning, :danger | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment