使用带有Rails 4应用程序的Bootstrap 3,我在我的application.html.erb文件中设置了flash [:notice],flash [:error],flash [:alert],如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
<div class='container'>
<ul class='nav nav-tabs'>
<li><%= link_to 'Wikis', wikis_path %></li>
<div class="pull-right user-info">
<% if user_signed_in? %>
Hello, <%= link_to current_user.name, edit_user_registration_path %> |
<%= link_to 'Sign Out', destroy_user_session_path, method: :delete …Run Code Online (Sandbox Code Playgroud)