Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Simple Ruby on Rails Application Designing URLs The Flash Message

My page has two notice messages??

Whenever I log in, I get the styled success message, as well as a generic one below it that isn't styled. This only applies for the notice messages. Any idea where the second one exists? I can't find it on my application.html.erb

<!DOCTYPE html>
<html>
<head>
  <title>Treebook</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
  <!-- <div class="container"> -->
    <ul class="nav navbar-nav">
        <li><a href="#" class="brand">Treebook</a></li>
        <li><%= link_to "News Feed", statuses_path %></li>
    </ul>
    <ul class="nav navbar-nav pull-right">
        <% if user_signed_in? %>
        <li><%= link_to current_user.full_name, edit_user_registration_path %></li>
        <li><%= link_to "Log Out", destroy_user_session_path, method: :delete %></li>
    </ul>
    <% else %>
    <li><%= link_to "Register", new_user_registration_path %></li>
    <li><%= link_to "Log In", user_session_path %></li>
    <% end %>
  <!-- </div> -->
</nav>
<div class="container">
    <% if flash[:notice] %>
    <div class="alert alert-success alert-dismissible" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close">
        <span aria-hidden="true">&times;</span></button>
        <%= flash[:notice] %>
    </div>
  <% end %>
  <% if flash[:alert] %>
    <div class="alert alert-danger alert-dismissible" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close">
        <span aria-hidden="true">&times;</span></button>
        <%= flash[:alert] %>
    </div>
  <% end %>
<%= yield %>
</div>
</body>
</html>

1 Answer

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

You probably have one at the top of one of your show or index views (or in all of them).

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Yeah, your statuses/show view:

<p id="notice"><%= notice %></p>

and your index view:

<p id="notice"><%= notice %></p>

I fixed that but it's still happening on the index page. I can't see why.

Maciej Czuchnowski
Maciej Czuchnowski
36,441 Points

Your index.html.erb still has this line:

<p id="notice"><%= notice %></p>